Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
| 31 | #include "hda_codec.h" |
| 32 | #include "hda_local.h" |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 33 | #include "hda_beep.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 35 | #define ALC880_FRONT_EVENT 0x01 |
| 36 | #define ALC880_DCVOL_EVENT 0x02 |
| 37 | #define ALC880_HP_EVENT 0x04 |
| 38 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
| 40 | /* ALC880 board config type */ |
| 41 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | ALC880_3ST, |
| 43 | ALC880_3ST_DIG, |
| 44 | ALC880_5ST, |
| 45 | ALC880_5ST_DIG, |
| 46 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 47 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 48 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 49 | ALC880_6ST_DIG, |
| 50 | ALC880_F1734, |
| 51 | ALC880_ASUS, |
| 52 | ALC880_ASUS_DIG, |
| 53 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 54 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 55 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 56 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL, |
| 58 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 59 | ALC880_CLEVO, |
| 60 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 61 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 62 | ALC880_LG_LW, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 63 | ALC880_MEDION_RIM, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 64 | #ifdef CONFIG_SND_DEBUG |
| 65 | ALC880_TEST, |
| 66 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 67 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 68 | ALC880_MODEL_LAST /* last tag */ |
| 69 | }; |
| 70 | |
| 71 | /* ALC260 models */ |
| 72 | enum { |
| 73 | ALC260_BASIC, |
| 74 | ALC260_HP, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 75 | ALC260_HP_DC7600, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 76 | ALC260_HP_3013, |
| 77 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 78 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 79 | ALC260_WILL, |
| 80 | ALC260_REPLACER_672V, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 81 | ALC260_FAVORIT100, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 82 | #ifdef CONFIG_SND_DEBUG |
| 83 | ALC260_TEST, |
| 84 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 85 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 86 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | }; |
| 88 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 89 | /* ALC262 models */ |
| 90 | enum { |
| 91 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 92 | ALC262_HIPPO, |
| 93 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 94 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 95 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 96 | ALC262_HP_BPC_D7000_WL, |
| 97 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 98 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 99 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 100 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 101 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 102 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 103 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 104 | ALC262_LENOVO_3000, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 105 | ALC262_NEC, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 106 | ALC262_TOSHIBA_S06, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 107 | ALC262_TOSHIBA_RX1, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 108 | ALC262_TYAN, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 109 | ALC262_AUTO, |
| 110 | ALC262_MODEL_LAST /* last tag */ |
| 111 | }; |
| 112 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 113 | /* ALC268 models */ |
| 114 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 115 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 116 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 117 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 118 | ALC268_ACER, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 119 | ALC268_ACER_DMIC, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 120 | ALC268_ACER_ASPIRE_ONE, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 121 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 122 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 123 | #ifdef CONFIG_SND_DEBUG |
| 124 | ALC268_TEST, |
| 125 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 126 | ALC268_AUTO, |
| 127 | ALC268_MODEL_LAST /* last tag */ |
| 128 | }; |
| 129 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 130 | /* ALC269 models */ |
| 131 | enum { |
| 132 | ALC269_BASIC, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 133 | ALC269_QUANTA_FL1, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 134 | ALC269_ASUS_AMIC, |
| 135 | ALC269_ASUS_DMIC, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 136 | ALC269_FUJITSU, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 137 | ALC269_LIFEBOOK, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 138 | ALC269_AUTO, |
| 139 | ALC269_MODEL_LAST /* last tag */ |
| 140 | }; |
| 141 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 142 | /* ALC861 models */ |
| 143 | enum { |
| 144 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 145 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 146 | ALC861_3ST_DIG, |
| 147 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 148 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 149 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 150 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 151 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 152 | ALC861_AUTO, |
| 153 | ALC861_MODEL_LAST, |
| 154 | }; |
| 155 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 156 | /* ALC861-VD models */ |
| 157 | enum { |
| 158 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 159 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 160 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 161 | ALC861VD_3ST, |
| 162 | ALC861VD_3ST_DIG, |
| 163 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 164 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 165 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 166 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 167 | ALC861VD_AUTO, |
| 168 | ALC861VD_MODEL_LAST, |
| 169 | }; |
| 170 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 171 | /* ALC662 models */ |
| 172 | enum { |
| 173 | ALC662_3ST_2ch_DIG, |
| 174 | ALC662_3ST_6ch_DIG, |
| 175 | ALC662_3ST_6ch, |
| 176 | ALC662_5ST_DIG, |
| 177 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 178 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 179 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 180 | ALC663_ASUS_M51VA, |
| 181 | ALC663_ASUS_G71V, |
| 182 | ALC663_ASUS_H13, |
| 183 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 184 | ALC662_ECS, |
| 185 | ALC663_ASUS_MODE1, |
| 186 | ALC662_ASUS_MODE2, |
| 187 | ALC663_ASUS_MODE3, |
| 188 | ALC663_ASUS_MODE4, |
| 189 | ALC663_ASUS_MODE5, |
| 190 | ALC663_ASUS_MODE6, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 191 | ALC663_ASUS_MODE7, |
| 192 | ALC663_ASUS_MODE8, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 193 | ALC272_DELL, |
| 194 | ALC272_DELL_ZM1, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 195 | ALC272_SAMSUNG_NC10, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 196 | ALC662_AUTO, |
| 197 | ALC662_MODEL_LAST, |
| 198 | }; |
| 199 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 200 | /* ALC882 models */ |
| 201 | enum { |
| 202 | ALC882_3ST_DIG, |
| 203 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 204 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 205 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 206 | ALC882_TARGA, |
| 207 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 208 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 209 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 210 | ALC885_MBP3, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 211 | ALC885_MB5, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 212 | ALC885_IMAC24, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 213 | ALC885_IMAC91, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 214 | ALC883_3ST_2ch_DIG, |
| 215 | ALC883_3ST_6ch_DIG, |
| 216 | ALC883_3ST_6ch, |
| 217 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 218 | ALC883_TARGA_DIG, |
| 219 | ALC883_TARGA_2ch_DIG, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 220 | ALC883_TARGA_8ch_DIG, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 221 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 222 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 223 | ALC888_ACER_ASPIRE_4930G, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 224 | ALC888_ACER_ASPIRE_6530G, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 225 | ALC888_ACER_ASPIRE_8930G, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 226 | ALC888_ACER_ASPIRE_7730G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 227 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 228 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 229 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 230 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 231 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 232 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 233 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 234 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 235 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 236 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 237 | ALC883_MITAC, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 238 | ALC883_CLEVO_M540R, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 239 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 240 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 241 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 242 | ALC883_3ST_6ch_INTEL, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 243 | ALC889A_INTEL, |
| 244 | ALC889_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 245 | ALC888_ASUS_M90V, |
| 246 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 247 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 248 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 249 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 250 | ALC882_AUTO, |
| 251 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 252 | }; |
| 253 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 254 | /* for GPIO Poll */ |
| 255 | #define GPIO_MASK 0x03 |
| 256 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 257 | /* extra amp-initialization sequence types */ |
| 258 | enum { |
| 259 | ALC_INIT_NONE, |
| 260 | ALC_INIT_DEFAULT, |
| 261 | ALC_INIT_GPIO1, |
| 262 | ALC_INIT_GPIO2, |
| 263 | ALC_INIT_GPIO3, |
| 264 | }; |
| 265 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 266 | struct alc_mic_route { |
| 267 | hda_nid_t pin; |
| 268 | unsigned char mux_idx; |
| 269 | unsigned char amix_idx; |
| 270 | }; |
| 271 | |
| 272 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 273 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 274 | struct alc_spec { |
| 275 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 276 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 277 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 278 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 279 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 280 | |
Takashi Iwai | 2d9c648 | 2009-10-13 08:06:55 +0200 | [diff] [blame] | 281 | const struct hda_verb *init_verbs[10]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 282 | * don't forget NULL |
| 283 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 284 | */ |
| 285 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 286 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 287 | char stream_name_analog[32]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 288 | struct hda_pcm_stream *stream_analog_playback; |
| 289 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 290 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 291 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 293 | char stream_name_digital[32]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 294 | struct hda_pcm_stream *stream_digital_playback; |
| 295 | struct hda_pcm_stream *stream_digital_capture; |
| 296 | |
| 297 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 298 | struct hda_multi_out multiout; /* playback set-up |
| 299 | * max_channels, dacs must be set |
| 300 | * dig_out_nid and hp_nid are optional |
| 301 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 302 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 303 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 304 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | |
| 306 | /* capture */ |
| 307 | unsigned int num_adc_nids; |
| 308 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 309 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 310 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 311 | |
| 312 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 313 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | const struct hda_input_mux *input_mux; |
| 315 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 316 | struct alc_mic_route ext_mic; |
| 317 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | |
| 319 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 320 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 321 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 322 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 323 | int const_channel_count; |
| 324 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 325 | |
| 326 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 327 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 328 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 329 | /* dynamic controls, init_verbs and input_mux */ |
| 330 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 331 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 332 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 333 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 334 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 335 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 336 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 337 | /* hooks */ |
| 338 | void (*init_hook)(struct hda_codec *codec); |
| 339 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 340 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 341 | /* for pin sensing */ |
| 342 | unsigned int sense_updated: 1; |
| 343 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 344 | unsigned int master_sw: 1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 345 | unsigned int auto_mic:1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 346 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 347 | /* other flags */ |
| 348 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 349 | int init_amp; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 350 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 351 | /* for virtual master */ |
| 352 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 353 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 354 | struct hda_loopback_check loopback; |
| 355 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 356 | |
| 357 | /* for PLL fix */ |
| 358 | hda_nid_t pll_nid; |
| 359 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 360 | }; |
| 361 | |
| 362 | /* |
| 363 | * configuration template - to be copied to the spec instance |
| 364 | */ |
| 365 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 366 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 367 | * with spec |
| 368 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 369 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 370 | const struct hda_verb *init_verbs[5]; |
| 371 | unsigned int num_dacs; |
| 372 | hda_nid_t *dac_nids; |
| 373 | hda_nid_t dig_out_nid; /* optional */ |
| 374 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 375 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 376 | unsigned int num_adc_nids; |
| 377 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 378 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 379 | hda_nid_t dig_in_nid; |
| 380 | unsigned int num_channel_mode; |
| 381 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 382 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 383 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 384 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 385 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 386 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 387 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 388 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 389 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 390 | struct hda_amp_list *loopbacks; |
| 391 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 392 | }; |
| 393 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 394 | |
| 395 | /* |
| 396 | * input MUX handling |
| 397 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 398 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 399 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 400 | { |
| 401 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 402 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 403 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 404 | if (mux_idx >= spec->num_mux_defs) |
| 405 | mux_idx = 0; |
| 406 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 407 | } |
| 408 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 409 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 410 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 411 | { |
| 412 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 413 | struct alc_spec *spec = codec->spec; |
| 414 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 415 | |
| 416 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 417 | return 0; |
| 418 | } |
| 419 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 420 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 421 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 422 | { |
| 423 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 424 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 425 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 426 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 427 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 428 | hda_nid_t nid = spec->capsrc_nids ? |
| 429 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 430 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 431 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 432 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 433 | imux = &spec->input_mux[mux_idx]; |
| 434 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 435 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 436 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 437 | /* Matrix-mixer style (e.g. ALC882) */ |
| 438 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 439 | unsigned int i, idx; |
| 440 | |
| 441 | idx = ucontrol->value.enumerated.item[0]; |
| 442 | if (idx >= imux->num_items) |
| 443 | idx = imux->num_items - 1; |
| 444 | if (*cur_val == idx) |
| 445 | return 0; |
| 446 | for (i = 0; i < imux->num_items; i++) { |
| 447 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 448 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 449 | imux->items[i].index, |
| 450 | HDA_AMP_MUTE, v); |
| 451 | } |
| 452 | *cur_val = idx; |
| 453 | return 1; |
| 454 | } else { |
| 455 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 456 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 457 | &spec->cur_mux[adc_idx]); |
| 458 | } |
| 459 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 460 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 461 | /* |
| 462 | * channel mode setting |
| 463 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 464 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 465 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 466 | { |
| 467 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 468 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 469 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 470 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 471 | } |
| 472 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 473 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 474 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 475 | { |
| 476 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 477 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 478 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 479 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 480 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 481 | } |
| 482 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 483 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 484 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 485 | { |
| 486 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 487 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 488 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 489 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 490 | &spec->ext_channel_count); |
| 491 | if (err >= 0 && !spec->const_channel_count) { |
| 492 | spec->multiout.max_channels = spec->ext_channel_count; |
| 493 | if (spec->need_dac_fix) |
| 494 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 495 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 496 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 497 | } |
| 498 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 499 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 500 | * 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] | 501 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 502 | * being part of a format specifier. Maximum allowed length of a value is |
| 503 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 504 | * |
| 505 | * Note: some retasking pin complexes seem to ignore requests for input |
| 506 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 507 | * are requested. Therefore order this list so that this behaviour will not |
| 508 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 509 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 510 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 511 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 512 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 513 | "Mic 50pc bias", "Mic 80pc bias", |
| 514 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 515 | }; |
| 516 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 517 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 518 | }; |
| 519 | /* 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] | 520 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 521 | * addition, "input" pins may or may not process the mic bias option |
| 522 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 523 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 524 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 525 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 526 | #define ALC_PIN_DIR_IN 0x00 |
| 527 | #define ALC_PIN_DIR_OUT 0x01 |
| 528 | #define ALC_PIN_DIR_INOUT 0x02 |
| 529 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 530 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 531 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 532 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 533 | * For each direction the minimum and maximum values are given. |
| 534 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 535 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 536 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 537 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 538 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 539 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 540 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 541 | }; |
| 542 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 543 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 544 | #define alc_pin_mode_n_items(_dir) \ |
| 545 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 546 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 547 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 548 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 549 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 550 | unsigned int item_num = uinfo->value.enumerated.item; |
| 551 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 552 | |
| 553 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 554 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 555 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 556 | |
| 557 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 558 | item_num = alc_pin_mode_min(dir); |
| 559 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 560 | return 0; |
| 561 | } |
| 562 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 563 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 564 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 565 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 566 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 567 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 568 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 569 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 570 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 571 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 572 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 573 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 574 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 575 | /* Find enumerated value for current pinctl setting */ |
| 576 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2c | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 577 | 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] | 578 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 579 | *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] | 580 | return 0; |
| 581 | } |
| 582 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 583 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 584 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 585 | { |
| 586 | signed int change; |
| 587 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 588 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 589 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 590 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 591 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 592 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 593 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 594 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 595 | 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] | 596 | val = alc_pin_mode_min(dir); |
| 597 | |
| 598 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 599 | if (change) { |
| 600 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 601 | snd_hda_codec_write_cache(codec, nid, 0, |
| 602 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 603 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 604 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 605 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 606 | * for the requested pin mode. Enum values of 2 or less are |
| 607 | * input modes. |
| 608 | * |
| 609 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 610 | * reduces noise slightly (particularly on input) so we'll |
| 611 | * do it. However, having both input and output buffers |
| 612 | * enabled simultaneously doesn't seem to be problematic if |
| 613 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 614 | */ |
| 615 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 616 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 617 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 618 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 619 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 620 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 621 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 622 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 623 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 624 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 625 | } |
| 626 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 627 | return change; |
| 628 | } |
| 629 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 630 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 631 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 632 | .info = alc_pin_mode_info, \ |
| 633 | .get = alc_pin_mode_get, \ |
| 634 | .put = alc_pin_mode_put, \ |
| 635 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 636 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 637 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 638 | * together using a mask with more than one bit set. This control is |
| 639 | * currently used only by the ALC260 test model. At this stage they are not |
| 640 | * needed for any "production" models. |
| 641 | */ |
| 642 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 643 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 644 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 645 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 646 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 647 | { |
| 648 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 649 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 650 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 651 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 652 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 653 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 654 | |
| 655 | *valp = (val & mask) != 0; |
| 656 | return 0; |
| 657 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 658 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 659 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 660 | { |
| 661 | signed int change; |
| 662 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 663 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 664 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 665 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 666 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 667 | AC_VERB_GET_GPIO_DATA, |
| 668 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 669 | |
| 670 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 671 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 672 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 673 | gpio_data &= ~mask; |
| 674 | else |
| 675 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 676 | snd_hda_codec_write_cache(codec, nid, 0, |
| 677 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 678 | |
| 679 | return change; |
| 680 | } |
| 681 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 682 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 683 | .info = alc_gpio_data_info, \ |
| 684 | .get = alc_gpio_data_get, \ |
| 685 | .put = alc_gpio_data_put, \ |
| 686 | .private_value = nid | (mask<<16) } |
| 687 | #endif /* CONFIG_SND_DEBUG */ |
| 688 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 689 | /* A switch control to allow the enabling of the digital IO pins on the |
| 690 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 691 | * to provide something in the test model allowing digital outputs to be |
| 692 | * identified if present. If models are found which can utilise these |
| 693 | * outputs a more complete mixer control can be devised for those models if |
| 694 | * necessary. |
| 695 | */ |
| 696 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 697 | #define alc_spdif_ctrl_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_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 700 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +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, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 707 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +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_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 713 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +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 ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 721 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 722 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 723 | |
| 724 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 725 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 726 | if (val==0) |
| 727 | ctrl_data &= ~mask; |
| 728 | else |
| 729 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 730 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 731 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 732 | |
| 733 | return change; |
| 734 | } |
| 735 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 736 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 737 | .info = alc_spdif_ctrl_info, \ |
| 738 | .get = alc_spdif_ctrl_get, \ |
| 739 | .put = alc_spdif_ctrl_put, \ |
| 740 | .private_value = nid | (mask<<16) } |
| 741 | #endif /* CONFIG_SND_DEBUG */ |
| 742 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 743 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 744 | * Again, this is only used in the ALC26x test models to help identify when |
| 745 | * the EAPD line must be asserted for features to work. |
| 746 | */ |
| 747 | #ifdef CONFIG_SND_DEBUG |
| 748 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 749 | |
| 750 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 751 | struct snd_ctl_elem_value *ucontrol) |
| 752 | { |
| 753 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 754 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 755 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 756 | long *valp = ucontrol->value.integer.value; |
| 757 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 758 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 759 | |
| 760 | *valp = (val & mask) != 0; |
| 761 | return 0; |
| 762 | } |
| 763 | |
| 764 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 765 | struct snd_ctl_elem_value *ucontrol) |
| 766 | { |
| 767 | int change; |
| 768 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 769 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 770 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 771 | long val = *ucontrol->value.integer.value; |
| 772 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 773 | AC_VERB_GET_EAPD_BTLENABLE, |
| 774 | 0x00); |
| 775 | |
| 776 | /* Set/unset the masked control bit(s) as needed */ |
| 777 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 778 | if (!val) |
| 779 | ctrl_data &= ~mask; |
| 780 | else |
| 781 | ctrl_data |= mask; |
| 782 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 783 | ctrl_data); |
| 784 | |
| 785 | return change; |
| 786 | } |
| 787 | |
| 788 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 789 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 790 | .info = alc_eapd_ctrl_info, \ |
| 791 | .get = alc_eapd_ctrl_get, \ |
| 792 | .put = alc_eapd_ctrl_put, \ |
| 793 | .private_value = nid | (mask<<16) } |
| 794 | #endif /* CONFIG_SND_DEBUG */ |
| 795 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 796 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 797 | * set up the input pin config (depending on the given auto-pin type) |
| 798 | */ |
| 799 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 800 | int auto_pin_type) |
| 801 | { |
| 802 | unsigned int val = PIN_IN; |
| 803 | |
| 804 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { |
| 805 | unsigned int pincap; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 806 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 807 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 808 | if (pincap & AC_PINCAP_VREF_80) |
| 809 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 810 | else if (pincap & AC_PINCAP_VREF_50) |
| 811 | val = PIN_VREF50; |
| 812 | else if (pincap & AC_PINCAP_VREF_100) |
| 813 | val = PIN_VREF100; |
| 814 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 815 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 816 | } |
| 817 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 818 | } |
| 819 | |
| 820 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 821 | */ |
| 822 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 823 | { |
| 824 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 825 | return; |
| 826 | spec->mixers[spec->num_mixers++] = mix; |
| 827 | } |
| 828 | |
| 829 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 830 | { |
| 831 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 832 | return; |
| 833 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 834 | } |
| 835 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 836 | #ifdef CONFIG_PROC_FS |
| 837 | /* |
| 838 | * hook for proc |
| 839 | */ |
| 840 | static void print_realtek_coef(struct snd_info_buffer *buffer, |
| 841 | struct hda_codec *codec, hda_nid_t nid) |
| 842 | { |
| 843 | int coeff; |
| 844 | |
| 845 | if (nid != 0x20) |
| 846 | return; |
| 847 | coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); |
| 848 | snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); |
| 849 | coeff = snd_hda_codec_read(codec, nid, 0, |
| 850 | AC_VERB_GET_COEF_INDEX, 0); |
| 851 | snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); |
| 852 | } |
| 853 | #else |
| 854 | #define print_realtek_coef NULL |
| 855 | #endif |
| 856 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 857 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 858 | * set up from the preset table |
| 859 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 860 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 861 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 862 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 863 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 864 | int i; |
| 865 | |
| 866 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 867 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 868 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 869 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 870 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 871 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 872 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 873 | spec->channel_mode = preset->channel_mode; |
| 874 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 875 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 876 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 877 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 878 | if (preset->const_channel_count) |
| 879 | spec->multiout.max_channels = preset->const_channel_count; |
| 880 | else |
| 881 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 882 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 883 | |
| 884 | spec->multiout.num_dacs = preset->num_dacs; |
| 885 | spec->multiout.dac_nids = preset->dac_nids; |
| 886 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 887 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 888 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 889 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 890 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 891 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 892 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 893 | spec->input_mux = preset->input_mux; |
| 894 | |
| 895 | spec->num_adc_nids = preset->num_adc_nids; |
| 896 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 897 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 898 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 899 | |
| 900 | spec->unsol_event = preset->unsol_event; |
| 901 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 902 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 903 | spec->loopback.amplist = preset->loopbacks; |
| 904 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 905 | |
| 906 | if (preset->setup) |
| 907 | preset->setup(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 908 | } |
| 909 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 910 | /* Enable GPIO mask and set output */ |
| 911 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 912 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 913 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 914 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 915 | { } |
| 916 | }; |
| 917 | |
| 918 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 919 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 920 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 921 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 922 | { } |
| 923 | }; |
| 924 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 925 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 926 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 927 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 928 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 929 | { } |
| 930 | }; |
| 931 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 932 | /* |
| 933 | * Fix hardware PLL issue |
| 934 | * On some codecs, the analog PLL gating control must be off while |
| 935 | * the default value is 1. |
| 936 | */ |
| 937 | static void alc_fix_pll(struct hda_codec *codec) |
| 938 | { |
| 939 | struct alc_spec *spec = codec->spec; |
| 940 | unsigned int val; |
| 941 | |
| 942 | if (!spec->pll_nid) |
| 943 | return; |
| 944 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 945 | spec->pll_coef_idx); |
| 946 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 947 | AC_VERB_GET_PROC_COEF, 0); |
| 948 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 949 | spec->pll_coef_idx); |
| 950 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 951 | val & ~(1 << spec->pll_coef_bit)); |
| 952 | } |
| 953 | |
| 954 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 955 | unsigned int coef_idx, unsigned int coef_bit) |
| 956 | { |
| 957 | struct alc_spec *spec = codec->spec; |
| 958 | spec->pll_nid = nid; |
| 959 | spec->pll_coef_idx = coef_idx; |
| 960 | spec->pll_coef_bit = coef_bit; |
| 961 | alc_fix_pll(codec); |
| 962 | } |
| 963 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 964 | static void alc_automute_pin(struct hda_codec *codec) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 965 | { |
| 966 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 967 | unsigned int nid = spec->autocfg.hp_pins[0]; |
| 968 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 969 | |
Takashi Iwai | ad87c64 | 2009-11-02 14:23:15 +0100 | [diff] [blame] | 970 | if (!nid) |
| 971 | return; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 972 | spec->jack_present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 973 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 974 | nid = spec->autocfg.speaker_pins[i]; |
| 975 | if (!nid) |
| 976 | break; |
| 977 | snd_hda_codec_write(codec, nid, 0, |
| 978 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 979 | spec->jack_present ? 0 : PIN_OUT); |
| 980 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 981 | } |
| 982 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 983 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 984 | hda_nid_t nid) |
| 985 | { |
| 986 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 987 | int i, nums; |
| 988 | |
| 989 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 990 | for (i = 0; i < nums; i++) |
| 991 | if (conn[i] == nid) |
| 992 | return i; |
| 993 | return -1; |
| 994 | } |
| 995 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 996 | static void alc_mic_automute(struct hda_codec *codec) |
| 997 | { |
| 998 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 999 | struct alc_mic_route *dead, *alive; |
| 1000 | unsigned int present, type; |
| 1001 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1002 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1003 | if (!spec->auto_mic) |
| 1004 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1005 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1006 | return; |
| 1007 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1008 | return; |
| 1009 | |
| 1010 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1011 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1012 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1013 | if (present) { |
| 1014 | alive = &spec->ext_mic; |
| 1015 | dead = &spec->int_mic; |
| 1016 | } else { |
| 1017 | alive = &spec->int_mic; |
| 1018 | dead = &spec->ext_mic; |
| 1019 | } |
| 1020 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1021 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1022 | if (type == AC_WID_AUD_MIX) { |
| 1023 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1024 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1025 | alive->mux_idx, |
| 1026 | HDA_AMP_MUTE, 0); |
| 1027 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1028 | dead->mux_idx, |
| 1029 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1030 | } else { |
| 1031 | /* MUX style (e.g. ALC880) */ |
| 1032 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1033 | AC_VERB_SET_CONNECT_SEL, |
| 1034 | alive->mux_idx); |
| 1035 | } |
| 1036 | |
| 1037 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1038 | } |
| 1039 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1040 | /* unsolicited event for HP jack sensing */ |
| 1041 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1042 | { |
| 1043 | if (codec->vendor_id == 0x10ec0880) |
| 1044 | res >>= 28; |
| 1045 | else |
| 1046 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1047 | switch (res) { |
| 1048 | case ALC880_HP_EVENT: |
| 1049 | alc_automute_pin(codec); |
| 1050 | break; |
| 1051 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1052 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1053 | break; |
| 1054 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1055 | } |
| 1056 | |
| 1057 | static void alc_inithook(struct hda_codec *codec) |
| 1058 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1059 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1060 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1061 | } |
| 1062 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1063 | /* additional initialization for ALC888 variants */ |
| 1064 | static void alc888_coef_init(struct hda_codec *codec) |
| 1065 | { |
| 1066 | unsigned int tmp; |
| 1067 | |
| 1068 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1069 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1070 | 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] | 1071 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1072 | /* alc888S-VC */ |
| 1073 | snd_hda_codec_read(codec, 0x20, 0, |
| 1074 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1075 | else |
| 1076 | /* alc888-VB */ |
| 1077 | snd_hda_codec_read(codec, 0x20, 0, |
| 1078 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1079 | } |
| 1080 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1081 | static void alc889_coef_init(struct hda_codec *codec) |
| 1082 | { |
| 1083 | unsigned int tmp; |
| 1084 | |
| 1085 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1086 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1087 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1088 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1089 | } |
| 1090 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1091 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1092 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1093 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1094 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1095 | switch (type) { |
| 1096 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1097 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1098 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1099 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1100 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1101 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1102 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1103 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1104 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1105 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1106 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1107 | case 0x10ec0260: |
| 1108 | snd_hda_codec_write(codec, 0x0f, 0, |
| 1109 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1110 | snd_hda_codec_write(codec, 0x10, 0, |
| 1111 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1112 | break; |
| 1113 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1114 | case 0x10ec0267: |
| 1115 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1116 | case 0x10ec0269: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1117 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1118 | case 0x10ec0660: |
| 1119 | case 0x10ec0662: |
| 1120 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1121 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1122 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1123 | snd_hda_codec_write(codec, 0x14, 0, |
| 1124 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1125 | snd_hda_codec_write(codec, 0x15, 0, |
| 1126 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1127 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1128 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1129 | switch (codec->vendor_id) { |
| 1130 | case 0x10ec0260: |
| 1131 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1132 | AC_VERB_SET_COEF_INDEX, 7); |
| 1133 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1134 | AC_VERB_GET_PROC_COEF, 0); |
| 1135 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1136 | AC_VERB_SET_COEF_INDEX, 7); |
| 1137 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1138 | AC_VERB_SET_PROC_COEF, |
| 1139 | tmp | 0x2010); |
| 1140 | break; |
| 1141 | case 0x10ec0262: |
| 1142 | case 0x10ec0880: |
| 1143 | case 0x10ec0882: |
| 1144 | case 0x10ec0883: |
| 1145 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1146 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1147 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1148 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1149 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1150 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1151 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1152 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1153 | case 0x10ec0267: |
| 1154 | case 0x10ec0268: |
| 1155 | snd_hda_codec_write(codec, 0x20, 0, |
| 1156 | AC_VERB_SET_COEF_INDEX, 7); |
| 1157 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1158 | AC_VERB_GET_PROC_COEF, 0); |
| 1159 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1160 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1161 | snd_hda_codec_write(codec, 0x20, 0, |
| 1162 | AC_VERB_SET_PROC_COEF, |
| 1163 | tmp | 0x3000); |
| 1164 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1165 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1166 | break; |
| 1167 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1168 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1169 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1170 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1171 | { |
| 1172 | struct alc_spec *spec = codec->spec; |
| 1173 | |
| 1174 | if (!spec->autocfg.hp_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1175 | return; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1176 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1177 | if (!spec->autocfg.speaker_pins[0]) { |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1178 | if (spec->autocfg.line_out_pins[0] && |
| 1179 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1180 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1181 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1182 | else |
| 1183 | return; |
| 1184 | } |
| 1185 | |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1186 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1187 | spec->autocfg.hp_pins[0]); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1188 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, |
| 1189 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1190 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1191 | spec->unsol_event = alc_sku_unsol_event; |
| 1192 | } |
| 1193 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1194 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1195 | { |
| 1196 | struct alc_spec *spec = codec->spec; |
| 1197 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1198 | hda_nid_t fixed, ext; |
| 1199 | int i; |
| 1200 | |
| 1201 | /* there must be only two mic inputs exclusively */ |
| 1202 | for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++) |
| 1203 | if (cfg->input_pins[i]) |
| 1204 | return; |
| 1205 | |
| 1206 | fixed = ext = 0; |
| 1207 | for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) { |
| 1208 | hda_nid_t nid = cfg->input_pins[i]; |
| 1209 | unsigned int defcfg; |
| 1210 | if (!nid) |
| 1211 | return; |
| 1212 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
| 1213 | switch (get_defcfg_connect(defcfg)) { |
| 1214 | case AC_JACK_PORT_FIXED: |
| 1215 | if (fixed) |
| 1216 | return; /* already occupied */ |
| 1217 | fixed = nid; |
| 1218 | break; |
| 1219 | case AC_JACK_PORT_COMPLEX: |
| 1220 | if (ext) |
| 1221 | return; /* already occupied */ |
| 1222 | ext = nid; |
| 1223 | break; |
| 1224 | default: |
| 1225 | return; /* invalid entry */ |
| 1226 | } |
| 1227 | } |
| 1228 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1229 | return; /* no unsol support */ |
| 1230 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1231 | ext, fixed); |
| 1232 | spec->ext_mic.pin = ext; |
| 1233 | spec->int_mic.pin = fixed; |
| 1234 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1235 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1236 | spec->auto_mic = 1; |
| 1237 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1238 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1239 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1240 | spec->unsol_event = alc_sku_unsol_event; |
| 1241 | } |
| 1242 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1243 | /* check subsystem ID and set up device-specific initialization; |
| 1244 | * return 1 if initialized, 0 if invalid SSID |
| 1245 | */ |
| 1246 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1247 | * 31 ~ 16 : Manufacture ID |
| 1248 | * 15 ~ 8 : SKU ID |
| 1249 | * 7 ~ 0 : Assembly ID |
| 1250 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1251 | */ |
| 1252 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1253 | hda_nid_t porta, hda_nid_t porte, |
| 1254 | hda_nid_t portd) |
| 1255 | { |
| 1256 | unsigned int ass, tmp, i; |
| 1257 | unsigned nid; |
| 1258 | struct alc_spec *spec = codec->spec; |
| 1259 | |
| 1260 | ass = codec->subsystem_id & 0xffff; |
| 1261 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1262 | goto do_sku; |
| 1263 | |
| 1264 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1265 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1266 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1267 | * 29~21 : reserve |
| 1268 | * 20 : PCBEEP input |
| 1269 | * 19~16 : Check sum (15:1) |
| 1270 | * 15~1 : Custom |
| 1271 | * 0 : override |
| 1272 | */ |
| 1273 | nid = 0x1d; |
| 1274 | if (codec->vendor_id == 0x10ec0260) |
| 1275 | nid = 0x17; |
| 1276 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1277 | snd_printd("realtek: No valid SSID, " |
| 1278 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1279 | ass, nid); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1280 | if (!(ass & 1) && !(ass & 0x100000)) |
| 1281 | return 0; |
| 1282 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1283 | return 0; |
| 1284 | |
| 1285 | /* check sum */ |
| 1286 | tmp = 0; |
| 1287 | for (i = 1; i < 16; i++) { |
| 1288 | if ((ass >> i) & 1) |
| 1289 | tmp++; |
| 1290 | } |
| 1291 | if (((ass >> 16) & 0xf) != tmp) |
| 1292 | return 0; |
| 1293 | do_sku: |
| 1294 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1295 | ass & 0xffff, codec->vendor_id); |
| 1296 | /* |
| 1297 | * 0 : override |
| 1298 | * 1 : Swap Jack |
| 1299 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1300 | * 3~5 : External Amplifier control |
| 1301 | * 7~6 : Reserved |
| 1302 | */ |
| 1303 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1304 | switch (tmp) { |
| 1305 | case 1: |
| 1306 | spec->init_amp = ALC_INIT_GPIO1; |
| 1307 | break; |
| 1308 | case 3: |
| 1309 | spec->init_amp = ALC_INIT_GPIO2; |
| 1310 | break; |
| 1311 | case 7: |
| 1312 | spec->init_amp = ALC_INIT_GPIO3; |
| 1313 | break; |
| 1314 | case 5: |
| 1315 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1316 | break; |
| 1317 | } |
| 1318 | |
| 1319 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1320 | * when the external headphone out jack is plugged" |
| 1321 | */ |
| 1322 | if (!(ass & 0x8000)) |
| 1323 | return 1; |
| 1324 | /* |
| 1325 | * 10~8 : Jack location |
| 1326 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1327 | * 14~13: Resvered |
| 1328 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1329 | * when the external headphone out jack is plugged" |
| 1330 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1331 | if (!spec->autocfg.hp_pins[0]) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1332 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1333 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1334 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1335 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1336 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1337 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1338 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1339 | nid = portd; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1340 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1341 | return 1; |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1342 | for (i = 0; i < spec->autocfg.line_outs; i++) |
| 1343 | if (spec->autocfg.line_out_pins[i] == nid) |
| 1344 | return 1; |
| 1345 | spec->autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1346 | } |
| 1347 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1348 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1349 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1350 | return 1; |
| 1351 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1352 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1353 | static void alc_ssid_check(struct hda_codec *codec, |
| 1354 | hda_nid_t porta, hda_nid_t porte, hda_nid_t portd) |
| 1355 | { |
| 1356 | if (!alc_subsystem_id(codec, porta, porte, portd)) { |
| 1357 | struct alc_spec *spec = codec->spec; |
| 1358 | snd_printd("realtek: " |
| 1359 | "Enable default setup for auto mode as fallback\n"); |
| 1360 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1361 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1362 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1363 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1364 | } |
| 1365 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1366 | /* |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1367 | * Fix-up pin default configurations and add default verbs |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1368 | */ |
| 1369 | |
| 1370 | struct alc_pincfg { |
| 1371 | hda_nid_t nid; |
| 1372 | u32 val; |
| 1373 | }; |
| 1374 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1375 | struct alc_fixup { |
| 1376 | const struct alc_pincfg *pins; |
| 1377 | const struct hda_verb *verbs; |
| 1378 | }; |
| 1379 | |
| 1380 | static void alc_pick_fixup(struct hda_codec *codec, |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1381 | const struct snd_pci_quirk *quirk, |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1382 | const struct alc_fixup *fix) |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1383 | { |
| 1384 | const struct alc_pincfg *cfg; |
| 1385 | |
| 1386 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1387 | if (!quirk) |
| 1388 | return; |
| 1389 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1390 | fix += quirk->value; |
| 1391 | cfg = fix->pins; |
| 1392 | if (cfg) { |
| 1393 | for (; cfg->nid; cfg++) |
| 1394 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
| 1395 | } |
| 1396 | if (fix->verbs) |
| 1397 | add_verb(codec->spec, fix->verbs); |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1398 | } |
| 1399 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 1400 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 1401 | unsigned int coef_idx) |
| 1402 | { |
| 1403 | unsigned int val; |
| 1404 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1405 | coef_idx); |
| 1406 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 1407 | AC_VERB_GET_PROC_COEF, 0); |
| 1408 | return val; |
| 1409 | } |
| 1410 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1411 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1412 | * ALC888 |
| 1413 | */ |
| 1414 | |
| 1415 | /* |
| 1416 | * 2ch mode |
| 1417 | */ |
| 1418 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1419 | /* Mic-in jack as mic in */ |
| 1420 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1421 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1422 | /* Line-in jack as Line in */ |
| 1423 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1424 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1425 | /* Line-Out as Front */ |
| 1426 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1427 | { } /* end */ |
| 1428 | }; |
| 1429 | |
| 1430 | /* |
| 1431 | * 4ch mode |
| 1432 | */ |
| 1433 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1434 | /* Mic-in jack as mic in */ |
| 1435 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1436 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1437 | /* Line-in jack as Surround */ |
| 1438 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1439 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1440 | /* Line-Out as Front */ |
| 1441 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1442 | { } /* end */ |
| 1443 | }; |
| 1444 | |
| 1445 | /* |
| 1446 | * 6ch mode |
| 1447 | */ |
| 1448 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1449 | /* Mic-in jack as CLFE */ |
| 1450 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1451 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1452 | /* Line-in jack as Surround */ |
| 1453 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1454 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1455 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1456 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1457 | { } /* end */ |
| 1458 | }; |
| 1459 | |
| 1460 | /* |
| 1461 | * 8ch mode |
| 1462 | */ |
| 1463 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1464 | /* Mic-in jack as CLFE */ |
| 1465 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1466 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1467 | /* Line-in jack as Surround */ |
| 1468 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1469 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1470 | /* Line-Out as Side */ |
| 1471 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1472 | { } /* end */ |
| 1473 | }; |
| 1474 | |
| 1475 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1476 | { 2, alc888_4ST_ch2_intel_init }, |
| 1477 | { 4, alc888_4ST_ch4_intel_init }, |
| 1478 | { 6, alc888_4ST_ch6_intel_init }, |
| 1479 | { 8, alc888_4ST_ch8_intel_init }, |
| 1480 | }; |
| 1481 | |
| 1482 | /* |
| 1483 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1484 | */ |
| 1485 | |
| 1486 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1487 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1488 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1489 | /* Connect Internal HP to Front */ |
| 1490 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1491 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1492 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1493 | /* Connect Bass HP to Front */ |
| 1494 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1495 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1496 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1497 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1498 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1499 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1500 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1501 | /* Connect Mic jack to CLFE */ |
| 1502 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1503 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1504 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1505 | /* Connect Line-in jack to Surround */ |
| 1506 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1507 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1508 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1509 | /* Connect HP out jack to Front */ |
| 1510 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1511 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1512 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1513 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1514 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1515 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1516 | {} |
| 1517 | }; |
| 1518 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1519 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1520 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1521 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1522 | unsigned int mute; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1523 | hda_nid_t nid; |
| 1524 | int i; |
| 1525 | |
| 1526 | spec->jack_present = 0; |
| 1527 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1528 | nid = spec->autocfg.hp_pins[i]; |
| 1529 | if (!nid) |
| 1530 | break; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1531 | if (snd_hda_jack_detect(codec, nid)) { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1532 | spec->jack_present = 1; |
| 1533 | break; |
| 1534 | } |
| 1535 | } |
| 1536 | |
| 1537 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1538 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1539 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1540 | nid = spec->autocfg.speaker_pins[i]; |
| 1541 | if (!nid) |
| 1542 | break; |
| 1543 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1544 | HDA_AMP_MUTE, mute); |
| 1545 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1546 | } |
| 1547 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1548 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1549 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1550 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1551 | if (codec->vendor_id == 0x10ec0880) |
| 1552 | res >>= 28; |
| 1553 | else |
| 1554 | res >>= 26; |
| 1555 | if (res == ALC880_HP_EVENT) |
| 1556 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1557 | } |
| 1558 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1559 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1560 | { |
| 1561 | struct alc_spec *spec = codec->spec; |
| 1562 | |
| 1563 | spec->autocfg.hp_pins[0] = 0x15; |
| 1564 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1565 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1566 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1567 | spec->autocfg.speaker_pins[3] = 0x19; |
| 1568 | spec->autocfg.speaker_pins[4] = 0x1a; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1569 | } |
| 1570 | |
| 1571 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 1572 | { |
| 1573 | alc889_coef_init(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1574 | alc_automute_amp(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1575 | } |
| 1576 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1577 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1578 | { |
| 1579 | struct alc_spec *spec = codec->spec; |
| 1580 | |
| 1581 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1582 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1583 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1584 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1585 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1586 | |
| 1587 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1588 | * ALC888 Acer Aspire 4930G model |
| 1589 | */ |
| 1590 | |
| 1591 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1592 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1593 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1594 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1595 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1596 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1597 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1598 | /* Connect Internal HP to front */ |
| 1599 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1600 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1601 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1602 | /* Connect HP out to front */ |
| 1603 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1604 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1605 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1606 | { } |
| 1607 | }; |
| 1608 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1609 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1610 | * ALC888 Acer Aspire 6530G model |
| 1611 | */ |
| 1612 | |
| 1613 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
| 1614 | /* Bias voltage on for external mic port */ |
| 1615 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1616 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1617 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1618 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1619 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1620 | /* Enable unsolicited event for HP jack */ |
| 1621 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1622 | /* Enable speaker output */ |
| 1623 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1624 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1625 | /* Enable headphone output */ |
| 1626 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 1627 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1628 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1629 | { } |
| 1630 | }; |
| 1631 | |
| 1632 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1633 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1634 | */ |
| 1635 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1636 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1637 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1638 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1639 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1640 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 1641 | /* Enable unsolicited event for HP jack */ |
| 1642 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1643 | /* Connect Internal Front to Front */ |
| 1644 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1645 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1646 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1647 | /* Connect Internal Rear to Rear */ |
| 1648 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1649 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1650 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1651 | /* Connect Internal CLFE to CLFE */ |
| 1652 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1653 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1654 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1655 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1656 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1657 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1658 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1659 | /* Enable all DACs */ |
| 1660 | /* DAC DISABLE/MUTE 1? */ |
| 1661 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 1662 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 1663 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1664 | /* DAC DISABLE/MUTE 2? */ |
| 1665 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 1666 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 1667 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1668 | /* Enable amplifiers */ |
| 1669 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 1670 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1671 | /* DMIC fix |
| 1672 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 1673 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 1674 | * makes the signal become a difference/sum signal instead of standard |
| 1675 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 1676 | * codec replicate the sum signal to both channels, turning it into a |
| 1677 | * normal mono mic. |
| 1678 | */ |
| 1679 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 1680 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 1681 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1682 | { } |
| 1683 | }; |
| 1684 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1685 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1686 | /* Front mic only available on one ADC */ |
| 1687 | { |
| 1688 | .num_items = 4, |
| 1689 | .items = { |
| 1690 | { "Mic", 0x0 }, |
| 1691 | { "Line", 0x2 }, |
| 1692 | { "CD", 0x4 }, |
| 1693 | { "Front Mic", 0xb }, |
| 1694 | }, |
| 1695 | }, |
| 1696 | { |
| 1697 | .num_items = 3, |
| 1698 | .items = { |
| 1699 | { "Mic", 0x0 }, |
| 1700 | { "Line", 0x2 }, |
| 1701 | { "CD", 0x4 }, |
| 1702 | }, |
| 1703 | } |
| 1704 | }; |
| 1705 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1706 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 1707 | /* Interal mic only available on one ADC */ |
| 1708 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1709 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1710 | .items = { |
| 1711 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1712 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1713 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1714 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1715 | { "Int Mic", 0xb }, |
| 1716 | }, |
| 1717 | }, |
| 1718 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1719 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1720 | .items = { |
| 1721 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1722 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1723 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1724 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1725 | }, |
| 1726 | } |
| 1727 | }; |
| 1728 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1729 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 1730 | /* Digital mic only available on first "ADC" */ |
| 1731 | { |
| 1732 | .num_items = 5, |
| 1733 | .items = { |
| 1734 | { "Mic", 0x0 }, |
| 1735 | { "Line", 0x2 }, |
| 1736 | { "CD", 0x4 }, |
| 1737 | { "Front Mic", 0xb }, |
| 1738 | { "Input Mix", 0xa }, |
| 1739 | }, |
| 1740 | }, |
| 1741 | { |
| 1742 | .num_items = 4, |
| 1743 | .items = { |
| 1744 | { "Mic", 0x0 }, |
| 1745 | { "Line", 0x2 }, |
| 1746 | { "CD", 0x4 }, |
| 1747 | { "Input Mix", 0xa }, |
| 1748 | }, |
| 1749 | }, |
| 1750 | { |
| 1751 | .num_items = 4, |
| 1752 | .items = { |
| 1753 | { "Mic", 0x0 }, |
| 1754 | { "Line", 0x2 }, |
| 1755 | { "CD", 0x4 }, |
| 1756 | { "Input Mix", 0xa }, |
| 1757 | }, |
| 1758 | } |
| 1759 | }; |
| 1760 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1761 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1762 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1763 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1764 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1765 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1766 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1767 | HDA_OUTPUT), |
| 1768 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1769 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1770 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1771 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1772 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1773 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1774 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1775 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1776 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1777 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1778 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1779 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1780 | { } /* end */ |
| 1781 | }; |
| 1782 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1783 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1784 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1785 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1786 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1787 | spec->autocfg.hp_pins[0] = 0x15; |
| 1788 | spec->autocfg.speaker_pins[0] = 0x14; |
Łukasz Wojniłowicz | 7cef4cf | 2009-11-20 12:14:35 +0100 | [diff] [blame] | 1789 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1790 | spec->autocfg.speaker_pins[2] = 0x17; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1791 | } |
| 1792 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1793 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1794 | { |
| 1795 | struct alc_spec *spec = codec->spec; |
| 1796 | |
| 1797 | spec->autocfg.hp_pins[0] = 0x15; |
| 1798 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1799 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1800 | spec->autocfg.speaker_pins[2] = 0x17; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1801 | } |
| 1802 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1803 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1804 | { |
| 1805 | struct alc_spec *spec = codec->spec; |
| 1806 | |
| 1807 | spec->autocfg.hp_pins[0] = 0x15; |
| 1808 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1809 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1810 | spec->autocfg.speaker_pins[2] = 0x1b; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1811 | } |
| 1812 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1813 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1814 | * ALC880 3-stack model |
| 1815 | * |
| 1816 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1817 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1818 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1819 | */ |
| 1820 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1821 | static hda_nid_t alc880_dac_nids[4] = { |
| 1822 | /* front, rear, clfe, rear_surr */ |
| 1823 | 0x02, 0x05, 0x04, 0x03 |
| 1824 | }; |
| 1825 | |
| 1826 | static hda_nid_t alc880_adc_nids[3] = { |
| 1827 | /* ADC0-2 */ |
| 1828 | 0x07, 0x08, 0x09, |
| 1829 | }; |
| 1830 | |
| 1831 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1832 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1833 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1834 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1835 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1836 | /* ADC1-2 */ |
| 1837 | 0x08, 0x09, |
| 1838 | }; |
| 1839 | |
| 1840 | #define ALC880_DIGOUT_NID 0x06 |
| 1841 | #define ALC880_DIGIN_NID 0x0a |
| 1842 | |
| 1843 | static struct hda_input_mux alc880_capture_source = { |
| 1844 | .num_items = 4, |
| 1845 | .items = { |
| 1846 | { "Mic", 0x0 }, |
| 1847 | { "Front Mic", 0x3 }, |
| 1848 | { "Line", 0x2 }, |
| 1849 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1850 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1851 | }; |
| 1852 | |
| 1853 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1854 | /* 2ch mode */ |
| 1855 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1856 | /* set line-in to input, mute it */ |
| 1857 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1858 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1859 | /* set mic-in to input vref 80%, mute it */ |
| 1860 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1861 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1862 | { } /* end */ |
| 1863 | }; |
| 1864 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1865 | /* 6ch mode */ |
| 1866 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1867 | /* set line-in to output, unmute it */ |
| 1868 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1869 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1870 | /* set mic-in to output, unmute it */ |
| 1871 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1872 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1873 | { } /* end */ |
| 1874 | }; |
| 1875 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1876 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1877 | { 2, alc880_threestack_ch2_init }, |
| 1878 | { 6, alc880_threestack_ch6_init }, |
| 1879 | }; |
| 1880 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1881 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1882 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1883 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1884 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1885 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1886 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1887 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1888 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1889 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1890 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1891 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1892 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1893 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1894 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1895 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1896 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1897 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1898 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1899 | { |
| 1900 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1901 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1902 | .info = alc_ch_mode_info, |
| 1903 | .get = alc_ch_mode_get, |
| 1904 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1905 | }, |
| 1906 | { } /* end */ |
| 1907 | }; |
| 1908 | |
| 1909 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1910 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1911 | struct snd_ctl_elem_info *uinfo) |
| 1912 | { |
| 1913 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1914 | struct alc_spec *spec = codec->spec; |
| 1915 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1916 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1917 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1918 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1919 | HDA_INPUT); |
| 1920 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1921 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1922 | return err; |
| 1923 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1924 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1925 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1926 | unsigned int size, unsigned int __user *tlv) |
| 1927 | { |
| 1928 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1929 | struct alc_spec *spec = codec->spec; |
| 1930 | int err; |
| 1931 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1932 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1933 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1934 | HDA_INPUT); |
| 1935 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1936 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1937 | return err; |
| 1938 | } |
| 1939 | |
| 1940 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1941 | struct snd_ctl_elem_value *ucontrol); |
| 1942 | |
| 1943 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1944 | struct snd_ctl_elem_value *ucontrol, |
| 1945 | getput_call_t func) |
| 1946 | { |
| 1947 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1948 | struct alc_spec *spec = codec->spec; |
| 1949 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1950 | int err; |
| 1951 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1952 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1953 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1954 | 3, 0, HDA_INPUT); |
| 1955 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1956 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1957 | return err; |
| 1958 | } |
| 1959 | |
| 1960 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 1961 | struct snd_ctl_elem_value *ucontrol) |
| 1962 | { |
| 1963 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1964 | snd_hda_mixer_amp_volume_get); |
| 1965 | } |
| 1966 | |
| 1967 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 1968 | struct snd_ctl_elem_value *ucontrol) |
| 1969 | { |
| 1970 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1971 | snd_hda_mixer_amp_volume_put); |
| 1972 | } |
| 1973 | |
| 1974 | /* capture mixer elements */ |
| 1975 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 1976 | |
| 1977 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 1978 | struct snd_ctl_elem_value *ucontrol) |
| 1979 | { |
| 1980 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1981 | snd_hda_mixer_amp_switch_get); |
| 1982 | } |
| 1983 | |
| 1984 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 1985 | struct snd_ctl_elem_value *ucontrol) |
| 1986 | { |
| 1987 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1988 | snd_hda_mixer_amp_switch_put); |
| 1989 | } |
| 1990 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1991 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1992 | { \ |
| 1993 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1994 | .name = "Capture Switch", \ |
| 1995 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 1996 | .count = num, \ |
| 1997 | .info = alc_cap_sw_info, \ |
| 1998 | .get = alc_cap_sw_get, \ |
| 1999 | .put = alc_cap_sw_put, \ |
| 2000 | }, \ |
| 2001 | { \ |
| 2002 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2003 | .name = "Capture Volume", \ |
| 2004 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2005 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2006 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2007 | .count = num, \ |
| 2008 | .info = alc_cap_vol_info, \ |
| 2009 | .get = alc_cap_vol_get, \ |
| 2010 | .put = alc_cap_vol_put, \ |
| 2011 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2012 | } |
| 2013 | |
| 2014 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2015 | { \ |
| 2016 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2017 | /* .name = "Capture Source", */ \ |
| 2018 | .name = "Input Source", \ |
| 2019 | .count = num, \ |
| 2020 | .info = alc_mux_enum_info, \ |
| 2021 | .get = alc_mux_enum_get, \ |
| 2022 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2023 | } |
| 2024 | |
| 2025 | #define DEFINE_CAPMIX(num) \ |
| 2026 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2027 | _DEFINE_CAPMIX(num), \ |
| 2028 | _DEFINE_CAPSRC(num), \ |
| 2029 | { } /* end */ \ |
| 2030 | } |
| 2031 | |
| 2032 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2033 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2034 | _DEFINE_CAPMIX(num), \ |
| 2035 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2036 | } |
| 2037 | |
| 2038 | /* up to three ADCs */ |
| 2039 | DEFINE_CAPMIX(1); |
| 2040 | DEFINE_CAPMIX(2); |
| 2041 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2042 | DEFINE_CAPMIX_NOSRC(1); |
| 2043 | DEFINE_CAPMIX_NOSRC(2); |
| 2044 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2045 | |
| 2046 | /* |
| 2047 | * ALC880 5-stack model |
| 2048 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2049 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2050 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2051 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2052 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2053 | */ |
| 2054 | |
| 2055 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2056 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2057 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2058 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2059 | { } /* end */ |
| 2060 | }; |
| 2061 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2062 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2063 | /* 6ch mode */ |
| 2064 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2065 | /* set line-in to input, mute it */ |
| 2066 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2067 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2068 | { } /* end */ |
| 2069 | }; |
| 2070 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2071 | /* 8ch mode */ |
| 2072 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2073 | /* set line-in to output, unmute it */ |
| 2074 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2075 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2076 | { } /* end */ |
| 2077 | }; |
| 2078 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2079 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2080 | { 6, alc880_fivestack_ch6_init }, |
| 2081 | { 8, alc880_fivestack_ch8_init }, |
| 2082 | }; |
| 2083 | |
| 2084 | |
| 2085 | /* |
| 2086 | * ALC880 6-stack model |
| 2087 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2088 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2089 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2090 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2091 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2092 | */ |
| 2093 | |
| 2094 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2095 | /* front, rear, clfe, rear_surr */ |
| 2096 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2097 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2098 | |
| 2099 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2100 | .num_items = 4, |
| 2101 | .items = { |
| 2102 | { "Mic", 0x0 }, |
| 2103 | { "Front Mic", 0x1 }, |
| 2104 | { "Line", 0x2 }, |
| 2105 | { "CD", 0x4 }, |
| 2106 | }, |
| 2107 | }; |
| 2108 | |
| 2109 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2110 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2111 | { 8, NULL }, |
| 2112 | }; |
| 2113 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2114 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2115 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2116 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2117 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2118 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2119 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2120 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2121 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2122 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2123 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2124 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2125 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2126 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2127 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2128 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2129 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2130 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2131 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2132 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2133 | { |
| 2134 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2135 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2136 | .info = alc_ch_mode_info, |
| 2137 | .get = alc_ch_mode_get, |
| 2138 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2139 | }, |
| 2140 | { } /* end */ |
| 2141 | }; |
| 2142 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2143 | |
| 2144 | /* |
| 2145 | * ALC880 W810 model |
| 2146 | * |
| 2147 | * W810 has rear IO for: |
| 2148 | * Front (DAC 02) |
| 2149 | * Surround (DAC 03) |
| 2150 | * Center/LFE (DAC 04) |
| 2151 | * Digital out (06) |
| 2152 | * |
| 2153 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2154 | * 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] | 2155 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2156 | * There is a variable resistor to control the speaker or headphone |
| 2157 | * volume. This is a hardware-only device without a software API. |
| 2158 | * |
| 2159 | * Plugging headphones in will disable the internal speakers. This is |
| 2160 | * implemented in hardware, not via the driver using jack sense. In |
| 2161 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2162 | * disable both the speakers and headphones. |
| 2163 | * |
| 2164 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2165 | * These may not do anything useful with this driver yet, because I |
| 2166 | * haven't setup any initialization verbs for these yet... |
| 2167 | */ |
| 2168 | |
| 2169 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2170 | /* front, rear/surround, clfe */ |
| 2171 | 0x02, 0x03, 0x04 |
| 2172 | }; |
| 2173 | |
| 2174 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2175 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2176 | { 6, NULL } |
| 2177 | }; |
| 2178 | |
| 2179 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2180 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2181 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2182 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2183 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2184 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2185 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2186 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2187 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2188 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2189 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2190 | { } /* end */ |
| 2191 | }; |
| 2192 | |
| 2193 | |
| 2194 | /* |
| 2195 | * Z710V model |
| 2196 | * |
| 2197 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2198 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2199 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2200 | */ |
| 2201 | |
| 2202 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2203 | 0x02 |
| 2204 | }; |
| 2205 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2206 | |
| 2207 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2208 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2209 | { 2, NULL } |
| 2210 | }; |
| 2211 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2212 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2213 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2214 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2215 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2216 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2217 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2218 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2219 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2220 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2221 | { } /* end */ |
| 2222 | }; |
| 2223 | |
| 2224 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2225 | /* |
| 2226 | * ALC880 F1734 model |
| 2227 | * |
| 2228 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2229 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2230 | */ |
| 2231 | |
| 2232 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2233 | 0x03 |
| 2234 | }; |
| 2235 | #define ALC880_F1734_HP_DAC 0x02 |
| 2236 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2237 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2238 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2239 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2240 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2241 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2242 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2243 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2244 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2245 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2246 | { } /* end */ |
| 2247 | }; |
| 2248 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2249 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2250 | .num_items = 2, |
| 2251 | .items = { |
| 2252 | { "Mic", 0x1 }, |
| 2253 | { "CD", 0x4 }, |
| 2254 | }, |
| 2255 | }; |
| 2256 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2257 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2258 | /* |
| 2259 | * ALC880 ASUS model |
| 2260 | * |
| 2261 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2262 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2263 | * Mic = 0x18, Line = 0x1a |
| 2264 | */ |
| 2265 | |
| 2266 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2267 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2268 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2269 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2270 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2271 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2272 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2273 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2274 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2275 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2276 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2277 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2278 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2279 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2280 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2281 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2282 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2283 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2284 | { |
| 2285 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2286 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2287 | .info = alc_ch_mode_info, |
| 2288 | .get = alc_ch_mode_get, |
| 2289 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2290 | }, |
| 2291 | { } /* end */ |
| 2292 | }; |
| 2293 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2294 | /* |
| 2295 | * ALC880 ASUS W1V model |
| 2296 | * |
| 2297 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2298 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2299 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2300 | */ |
| 2301 | |
| 2302 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2303 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2304 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2305 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2306 | { } /* end */ |
| 2307 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2308 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2309 | /* TCL S700 */ |
| 2310 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2311 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2312 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2313 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2314 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2315 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2316 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2317 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2318 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2319 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2320 | { } /* end */ |
| 2321 | }; |
| 2322 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2323 | /* Uniwill */ |
| 2324 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2325 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2326 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2327 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2328 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2329 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2330 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2331 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2332 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2333 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2334 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2335 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2336 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2337 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2338 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2339 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2340 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2341 | { |
| 2342 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2343 | .name = "Channel Mode", |
| 2344 | .info = alc_ch_mode_info, |
| 2345 | .get = alc_ch_mode_get, |
| 2346 | .put = alc_ch_mode_put, |
| 2347 | }, |
| 2348 | { } /* end */ |
| 2349 | }; |
| 2350 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2351 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2352 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2353 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2354 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2355 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2356 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2357 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2358 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2359 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2360 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2361 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2362 | { } /* end */ |
| 2363 | }; |
| 2364 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2365 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2366 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2367 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2368 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2369 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2370 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2371 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2372 | { } /* end */ |
| 2373 | }; |
| 2374 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2375 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2376 | * virtual master controls |
| 2377 | */ |
| 2378 | |
| 2379 | /* |
| 2380 | * slave controls for virtual master |
| 2381 | */ |
| 2382 | static const char *alc_slave_vols[] = { |
| 2383 | "Front Playback Volume", |
| 2384 | "Surround Playback Volume", |
| 2385 | "Center Playback Volume", |
| 2386 | "LFE Playback Volume", |
| 2387 | "Side Playback Volume", |
| 2388 | "Headphone Playback Volume", |
| 2389 | "Speaker Playback Volume", |
| 2390 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2391 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2392 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2393 | NULL, |
| 2394 | }; |
| 2395 | |
| 2396 | static const char *alc_slave_sws[] = { |
| 2397 | "Front Playback Switch", |
| 2398 | "Surround Playback Switch", |
| 2399 | "Center Playback Switch", |
| 2400 | "LFE Playback Switch", |
| 2401 | "Side Playback Switch", |
| 2402 | "Headphone Playback Switch", |
| 2403 | "Speaker Playback Switch", |
| 2404 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2405 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 2406 | "Line-Out Playback Switch", |
| 2407 | "PCM Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2408 | NULL, |
| 2409 | }; |
| 2410 | |
| 2411 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2412 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2413 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2414 | |
| 2415 | static void alc_free_kctls(struct hda_codec *codec); |
| 2416 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2417 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2418 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2419 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2420 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 2421 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2422 | { } /* end */ |
| 2423 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2424 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2425 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2426 | static int alc_build_controls(struct hda_codec *codec) |
| 2427 | { |
| 2428 | struct alc_spec *spec = codec->spec; |
| 2429 | int err; |
| 2430 | int i; |
| 2431 | |
| 2432 | for (i = 0; i < spec->num_mixers; i++) { |
| 2433 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2434 | if (err < 0) |
| 2435 | return err; |
| 2436 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2437 | if (spec->cap_mixer) { |
| 2438 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2439 | if (err < 0) |
| 2440 | return err; |
| 2441 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2442 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2443 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2444 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2445 | if (err < 0) |
| 2446 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2447 | if (!spec->no_analog) { |
| 2448 | err = snd_hda_create_spdif_share_sw(codec, |
| 2449 | &spec->multiout); |
| 2450 | if (err < 0) |
| 2451 | return err; |
| 2452 | spec->multiout.share_spdif = 1; |
| 2453 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2454 | } |
| 2455 | if (spec->dig_in_nid) { |
| 2456 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2457 | if (err < 0) |
| 2458 | return err; |
| 2459 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2460 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2461 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2462 | /* create beep controls if needed */ |
| 2463 | if (spec->beep_amp) { |
| 2464 | struct snd_kcontrol_new *knew; |
| 2465 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2466 | struct snd_kcontrol *kctl; |
| 2467 | kctl = snd_ctl_new1(knew, codec); |
| 2468 | if (!kctl) |
| 2469 | return -ENOMEM; |
| 2470 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 3911a4c | 2009-11-11 13:43:01 +0100 | [diff] [blame] | 2471 | err = snd_hda_ctl_add(codec, |
| 2472 | get_amp_nid_(spec->beep_amp), kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2473 | if (err < 0) |
| 2474 | return err; |
| 2475 | } |
| 2476 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2477 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2478 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2479 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2480 | if (!spec->no_analog && |
| 2481 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2482 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2483 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2484 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2485 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2486 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2487 | if (err < 0) |
| 2488 | return err; |
| 2489 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2490 | if (!spec->no_analog && |
| 2491 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2492 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2493 | NULL, alc_slave_sws); |
| 2494 | if (err < 0) |
| 2495 | return err; |
| 2496 | } |
| 2497 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2498 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2499 | return 0; |
| 2500 | } |
| 2501 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2502 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2503 | /* |
| 2504 | * initialize the codec volumes, etc |
| 2505 | */ |
| 2506 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2507 | /* |
| 2508 | * generic initialization of ADC, input mixers and output mixers |
| 2509 | */ |
| 2510 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2511 | /* |
| 2512 | * Unmute ADC0-2 and set the default input to mic-in |
| 2513 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2514 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2515 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2516 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2517 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2518 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2519 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2520 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2521 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2522 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2523 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2524 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2525 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2526 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2527 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2528 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2529 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2530 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2531 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2532 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2533 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2534 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2535 | /* |
| 2536 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2537 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2538 | /* set vol=0 to output mixers */ |
| 2539 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2540 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2541 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2542 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2543 | /* set up input amps for analog loopback */ |
| 2544 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2545 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2546 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2547 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2548 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2549 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2550 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2551 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2552 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2553 | |
| 2554 | { } |
| 2555 | }; |
| 2556 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2557 | /* |
| 2558 | * 3-stack pin configuration: |
| 2559 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2560 | */ |
| 2561 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2562 | /* |
| 2563 | * preset connection lists of input pins |
| 2564 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2565 | */ |
| 2566 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2567 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2568 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2569 | |
| 2570 | /* |
| 2571 | * Set pin mode and muting |
| 2572 | */ |
| 2573 | /* set front pin widgets 0x14 for output */ |
| 2574 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2575 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2576 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2577 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2578 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2579 | /* Mic2 (as headphone out) for HP output */ |
| 2580 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2581 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2582 | /* Line In pin widget for input */ |
| 2583 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2584 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2585 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2586 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2587 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2588 | /* CD pin widget for input */ |
| 2589 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2590 | |
| 2591 | { } |
| 2592 | }; |
| 2593 | |
| 2594 | /* |
| 2595 | * 5-stack pin configuration: |
| 2596 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2597 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2598 | */ |
| 2599 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2600 | /* |
| 2601 | * preset connection lists of input pins |
| 2602 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2603 | */ |
| 2604 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2605 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2606 | |
| 2607 | /* |
| 2608 | * Set pin mode and muting |
| 2609 | */ |
| 2610 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2611 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2612 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2613 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2614 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2615 | /* unmute pins for output (no gain on this amp) */ |
| 2616 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2617 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2618 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2619 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2620 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2621 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2622 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2623 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2624 | /* Mic2 (as headphone out) for HP output */ |
| 2625 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2626 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2627 | /* Line In pin widget for input */ |
| 2628 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2629 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2630 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2631 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2632 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2633 | /* CD pin widget for input */ |
| 2634 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2635 | |
| 2636 | { } |
| 2637 | }; |
| 2638 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2639 | /* |
| 2640 | * W810 pin configuration: |
| 2641 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2642 | */ |
| 2643 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2644 | /* hphone/speaker input selector: front DAC */ |
| 2645 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2646 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2647 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2648 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2649 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2650 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2651 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2652 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2653 | |
| 2654 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2655 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2656 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2657 | { } |
| 2658 | }; |
| 2659 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2660 | /* |
| 2661 | * Z71V pin configuration: |
| 2662 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2663 | */ |
| 2664 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2665 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2666 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2667 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2668 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2669 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2670 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2671 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2672 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2673 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2674 | |
| 2675 | { } |
| 2676 | }; |
| 2677 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2678 | /* |
| 2679 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2680 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2681 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2682 | */ |
| 2683 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2684 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2685 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2686 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2687 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2688 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2689 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2690 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2691 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2692 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2693 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2694 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2695 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2696 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2697 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2698 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2699 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2700 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2701 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2702 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2703 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2704 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2705 | { } |
| 2706 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2707 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2708 | /* |
| 2709 | * Uniwill pin configuration: |
| 2710 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2711 | * line = 0x1a |
| 2712 | */ |
| 2713 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2714 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2715 | |
| 2716 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2717 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2718 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2719 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2720 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2721 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2722 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2723 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2724 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2725 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2726 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2727 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2728 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2729 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2730 | |
| 2731 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2732 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2733 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2734 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2735 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2736 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2737 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2738 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2739 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2740 | |
| 2741 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2742 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2743 | |
| 2744 | { } |
| 2745 | }; |
| 2746 | |
| 2747 | /* |
| 2748 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2749 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2750 | */ |
| 2751 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2752 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2753 | |
| 2754 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2755 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2756 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2757 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2758 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2759 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2760 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2761 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2762 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2763 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2764 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2765 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2766 | |
| 2767 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2768 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2769 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2770 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2771 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2772 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2773 | |
| 2774 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2775 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2776 | |
| 2777 | { } |
| 2778 | }; |
| 2779 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2780 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2781 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2782 | { } |
| 2783 | }; |
| 2784 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2785 | /* auto-toggle front mic */ |
| 2786 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2787 | { |
| 2788 | unsigned int present; |
| 2789 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2790 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 2791 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2792 | bits = present ? HDA_AMP_MUTE : 0; |
| 2793 | 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] | 2794 | } |
| 2795 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2796 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2797 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2798 | struct alc_spec *spec = codec->spec; |
| 2799 | |
| 2800 | spec->autocfg.hp_pins[0] = 0x14; |
| 2801 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2802 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2803 | } |
| 2804 | |
| 2805 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 2806 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2807 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2808 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2809 | } |
| 2810 | |
| 2811 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2812 | unsigned int res) |
| 2813 | { |
| 2814 | /* Looks like the unsol event is incompatible with the standard |
| 2815 | * definition. 4bit tag is placed at 28 bit! |
| 2816 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2817 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2818 | case ALC880_MIC_EVENT: |
| 2819 | alc880_uniwill_mic_automute(codec); |
| 2820 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2821 | default: |
| 2822 | alc_automute_amp_unsol_event(codec, res); |
| 2823 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2824 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2825 | } |
| 2826 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2827 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2828 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2829 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2830 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2831 | spec->autocfg.hp_pins[0] = 0x14; |
| 2832 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2833 | } |
| 2834 | |
| 2835 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2836 | { |
| 2837 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2838 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2839 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2840 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2841 | present &= HDA_AMP_VOLMASK; |
| 2842 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2843 | HDA_AMP_VOLMASK, present); |
| 2844 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2845 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2846 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2847 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2848 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2849 | unsigned int res) |
| 2850 | { |
| 2851 | /* Looks like the unsol event is incompatible with the standard |
| 2852 | * definition. 4bit tag is placed at 28 bit! |
| 2853 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2854 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2855 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2856 | else |
| 2857 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2858 | } |
| 2859 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2860 | /* |
| 2861 | * F1734 pin configuration: |
| 2862 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2863 | */ |
| 2864 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2865 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2866 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2867 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2868 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2869 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2870 | |
| 2871 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2872 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2873 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2874 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2875 | |
| 2876 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2877 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2878 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2879 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2880 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2881 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2882 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2883 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2884 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2885 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2886 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2887 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2888 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2889 | { } |
| 2890 | }; |
| 2891 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2892 | /* |
| 2893 | * ASUS pin configuration: |
| 2894 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2895 | */ |
| 2896 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2897 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2898 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2899 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2900 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2901 | |
| 2902 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2903 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2904 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2905 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2906 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2907 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2908 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2909 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2910 | |
| 2911 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2912 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2913 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2914 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2915 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2916 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2917 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2918 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2919 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2920 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2921 | { } |
| 2922 | }; |
| 2923 | |
| 2924 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2925 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2926 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 2927 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2928 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2929 | /* Clevo m520g init */ |
| 2930 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2931 | /* headphone output */ |
| 2932 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2933 | /* line-out */ |
| 2934 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2935 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2936 | /* Line-in */ |
| 2937 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2938 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2939 | /* CD */ |
| 2940 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2941 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2942 | /* Mic1 (rear panel) */ |
| 2943 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2944 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2945 | /* Mic2 (front panel) */ |
| 2946 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2947 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2948 | /* headphone */ |
| 2949 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2950 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2951 | /* change to EAPD mode */ |
| 2952 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2953 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2954 | |
| 2955 | { } |
| 2956 | }; |
| 2957 | |
| 2958 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2959 | /* change to EAPD mode */ |
| 2960 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2961 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2962 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2963 | /* Headphone output */ |
| 2964 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2965 | /* Front output*/ |
| 2966 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2967 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2968 | |
| 2969 | /* Line In pin widget for input */ |
| 2970 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2971 | /* CD pin widget for input */ |
| 2972 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2973 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2974 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2975 | |
| 2976 | /* change to EAPD mode */ |
| 2977 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2978 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2979 | |
| 2980 | { } |
| 2981 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2982 | |
| 2983 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2984 | * LG m1 express dual |
| 2985 | * |
| 2986 | * Pin assignment: |
| 2987 | * Rear Line-In/Out (blue): 0x14 |
| 2988 | * Build-in Mic-In: 0x15 |
| 2989 | * Speaker-out: 0x17 |
| 2990 | * HP-Out (green): 0x1b |
| 2991 | * Mic-In/Out (red): 0x19 |
| 2992 | * SPDIF-Out: 0x1e |
| 2993 | */ |
| 2994 | |
| 2995 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2996 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2997 | 0x05, 0x02, 0x03 |
| 2998 | }; |
| 2999 | |
| 3000 | /* seems analog CD is not working */ |
| 3001 | static struct hda_input_mux alc880_lg_capture_source = { |
| 3002 | .num_items = 3, |
| 3003 | .items = { |
| 3004 | { "Mic", 0x1 }, |
| 3005 | { "Line", 0x5 }, |
| 3006 | { "Internal Mic", 0x6 }, |
| 3007 | }, |
| 3008 | }; |
| 3009 | |
| 3010 | /* 2,4,6 channel modes */ |
| 3011 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 3012 | /* set line-in and mic-in to input */ |
| 3013 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3014 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3015 | { } |
| 3016 | }; |
| 3017 | |
| 3018 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 3019 | /* set line-in to out and mic-in to input */ |
| 3020 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3021 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3022 | { } |
| 3023 | }; |
| 3024 | |
| 3025 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3026 | /* set line-in and mic-in to output */ |
| 3027 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3028 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3029 | { } |
| 3030 | }; |
| 3031 | |
| 3032 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3033 | { 2, alc880_lg_ch2_init }, |
| 3034 | { 4, alc880_lg_ch4_init }, |
| 3035 | { 6, alc880_lg_ch6_init }, |
| 3036 | }; |
| 3037 | |
| 3038 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3039 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3040 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3041 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3042 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3043 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3044 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3045 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3046 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3047 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3048 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3049 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3050 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3051 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3052 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3053 | { |
| 3054 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3055 | .name = "Channel Mode", |
| 3056 | .info = alc_ch_mode_info, |
| 3057 | .get = alc_ch_mode_get, |
| 3058 | .put = alc_ch_mode_put, |
| 3059 | }, |
| 3060 | { } /* end */ |
| 3061 | }; |
| 3062 | |
| 3063 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3064 | /* set capture source to mic-in */ |
| 3065 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3066 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3067 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3068 | /* mute all amp mixer inputs */ |
| 3069 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3070 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3071 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3072 | /* line-in to input */ |
| 3073 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3074 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3075 | /* built-in mic */ |
| 3076 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3077 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3078 | /* speaker-out */ |
| 3079 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3080 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3081 | /* mic-in to input */ |
| 3082 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3083 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3084 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3085 | /* HP-out */ |
| 3086 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3087 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3088 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3089 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3090 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3091 | { } |
| 3092 | }; |
| 3093 | |
| 3094 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3095 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3096 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3097 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3098 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3099 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3100 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3101 | } |
| 3102 | |
| 3103 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3104 | * LG LW20 |
| 3105 | * |
| 3106 | * Pin assignment: |
| 3107 | * Speaker-out: 0x14 |
| 3108 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3109 | * Built-in Mic-In: 0x19 |
| 3110 | * Line-In: 0x1b |
| 3111 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3112 | * SPDIF-Out: 0x1e |
| 3113 | */ |
| 3114 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3115 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3116 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3117 | .items = { |
| 3118 | { "Mic", 0x0 }, |
| 3119 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3120 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3121 | }, |
| 3122 | }; |
| 3123 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3124 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3125 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3126 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3127 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3128 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3129 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3130 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3131 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3132 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3133 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3134 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3135 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3136 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3137 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3138 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3139 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3140 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3141 | { |
| 3142 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3143 | .name = "Channel Mode", |
| 3144 | .info = alc_ch_mode_info, |
| 3145 | .get = alc_ch_mode_get, |
| 3146 | .put = alc_ch_mode_put, |
| 3147 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3148 | { } /* end */ |
| 3149 | }; |
| 3150 | |
| 3151 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3152 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3153 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3154 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3155 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3156 | /* set capture source to mic-in */ |
| 3157 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3158 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3159 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3160 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3161 | /* speaker-out */ |
| 3162 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3163 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3164 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3165 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3166 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3167 | /* mic-in to input */ |
| 3168 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3169 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3170 | /* built-in mic */ |
| 3171 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3172 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3173 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3174 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3175 | { } |
| 3176 | }; |
| 3177 | |
| 3178 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3179 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3180 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3181 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3182 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3183 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3184 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3185 | } |
| 3186 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3187 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3188 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3189 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3190 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3191 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3192 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3193 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3194 | { } /* end */ |
| 3195 | }; |
| 3196 | |
| 3197 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3198 | .num_items = 2, |
| 3199 | .items = { |
| 3200 | { "Mic", 0x0 }, |
| 3201 | { "Internal Mic", 0x1 }, |
| 3202 | }, |
| 3203 | }; |
| 3204 | |
| 3205 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3206 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3207 | |
| 3208 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3209 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3210 | |
| 3211 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3212 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3213 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3214 | /* Mic2 (as headphone out) for HP output */ |
| 3215 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3216 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3217 | /* Internal Speaker */ |
| 3218 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3219 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3220 | |
| 3221 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3222 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3223 | |
| 3224 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3225 | { } |
| 3226 | }; |
| 3227 | |
| 3228 | /* toggle speaker-output according to the hp-jack state */ |
| 3229 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3230 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3231 | struct alc_spec *spec = codec->spec; |
| 3232 | alc_automute_amp(codec); |
| 3233 | /* toggle EAPD */ |
| 3234 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3235 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3236 | else |
| 3237 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3238 | } |
| 3239 | |
| 3240 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3241 | unsigned int res) |
| 3242 | { |
| 3243 | /* Looks like the unsol event is incompatible with the standard |
| 3244 | * definition. 4bit tag is placed at 28 bit! |
| 3245 | */ |
| 3246 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3247 | alc880_medion_rim_automute(codec); |
| 3248 | } |
| 3249 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3250 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3251 | { |
| 3252 | struct alc_spec *spec = codec->spec; |
| 3253 | |
| 3254 | spec->autocfg.hp_pins[0] = 0x14; |
| 3255 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3256 | } |
| 3257 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3258 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3259 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3260 | { 0x0b, HDA_INPUT, 0 }, |
| 3261 | { 0x0b, HDA_INPUT, 1 }, |
| 3262 | { 0x0b, HDA_INPUT, 2 }, |
| 3263 | { 0x0b, HDA_INPUT, 3 }, |
| 3264 | { 0x0b, HDA_INPUT, 4 }, |
| 3265 | { } /* end */ |
| 3266 | }; |
| 3267 | |
| 3268 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3269 | { 0x0b, HDA_INPUT, 1 }, |
| 3270 | { 0x0b, HDA_INPUT, 6 }, |
| 3271 | { 0x0b, HDA_INPUT, 7 }, |
| 3272 | { } /* end */ |
| 3273 | }; |
| 3274 | #endif |
| 3275 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3276 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3277 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3278 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3279 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3280 | static int alc_init(struct hda_codec *codec) |
| 3281 | { |
| 3282 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3283 | unsigned int i; |
| 3284 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3285 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3286 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3287 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3288 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3289 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3290 | |
| 3291 | if (spec->init_hook) |
| 3292 | spec->init_hook(codec); |
| 3293 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3294 | return 0; |
| 3295 | } |
| 3296 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3297 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3298 | { |
| 3299 | struct alc_spec *spec = codec->spec; |
| 3300 | |
| 3301 | if (spec->unsol_event) |
| 3302 | spec->unsol_event(codec, res); |
| 3303 | } |
| 3304 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3305 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3306 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3307 | { |
| 3308 | struct alc_spec *spec = codec->spec; |
| 3309 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3310 | } |
| 3311 | #endif |
| 3312 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3313 | /* |
| 3314 | * Analog playback callbacks |
| 3315 | */ |
| 3316 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3317 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3318 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3319 | { |
| 3320 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3321 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3322 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3323 | } |
| 3324 | |
| 3325 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3326 | struct hda_codec *codec, |
| 3327 | unsigned int stream_tag, |
| 3328 | unsigned int format, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3329 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3330 | { |
| 3331 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3332 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3333 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3334 | } |
| 3335 | |
| 3336 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3337 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3338 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3339 | { |
| 3340 | struct alc_spec *spec = codec->spec; |
| 3341 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3342 | } |
| 3343 | |
| 3344 | /* |
| 3345 | * Digital out |
| 3346 | */ |
| 3347 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3348 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3349 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3350 | { |
| 3351 | struct alc_spec *spec = codec->spec; |
| 3352 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3353 | } |
| 3354 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3355 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3356 | struct hda_codec *codec, |
| 3357 | unsigned int stream_tag, |
| 3358 | unsigned int format, |
| 3359 | struct snd_pcm_substream *substream) |
| 3360 | { |
| 3361 | struct alc_spec *spec = codec->spec; |
| 3362 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3363 | stream_tag, format, substream); |
| 3364 | } |
| 3365 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3366 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3367 | struct hda_codec *codec, |
| 3368 | struct snd_pcm_substream *substream) |
| 3369 | { |
| 3370 | struct alc_spec *spec = codec->spec; |
| 3371 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3372 | } |
| 3373 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3374 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3375 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3376 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3377 | { |
| 3378 | struct alc_spec *spec = codec->spec; |
| 3379 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3380 | } |
| 3381 | |
| 3382 | /* |
| 3383 | * Analog capture |
| 3384 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3385 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3386 | struct hda_codec *codec, |
| 3387 | unsigned int stream_tag, |
| 3388 | unsigned int format, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3389 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3390 | { |
| 3391 | struct alc_spec *spec = codec->spec; |
| 3392 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3393 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3394 | stream_tag, 0, format); |
| 3395 | return 0; |
| 3396 | } |
| 3397 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3398 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3399 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3400 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3401 | { |
| 3402 | struct alc_spec *spec = codec->spec; |
| 3403 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3404 | snd_hda_codec_cleanup_stream(codec, |
| 3405 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3406 | return 0; |
| 3407 | } |
| 3408 | |
| 3409 | |
| 3410 | /* |
| 3411 | */ |
| 3412 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3413 | .substreams = 1, |
| 3414 | .channels_min = 2, |
| 3415 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3416 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3417 | .ops = { |
| 3418 | .open = alc880_playback_pcm_open, |
| 3419 | .prepare = alc880_playback_pcm_prepare, |
| 3420 | .cleanup = alc880_playback_pcm_cleanup |
| 3421 | }, |
| 3422 | }; |
| 3423 | |
| 3424 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3425 | .substreams = 1, |
| 3426 | .channels_min = 2, |
| 3427 | .channels_max = 2, |
| 3428 | /* NID is set in alc_build_pcms */ |
| 3429 | }; |
| 3430 | |
| 3431 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3432 | .substreams = 1, |
| 3433 | .channels_min = 2, |
| 3434 | .channels_max = 2, |
| 3435 | /* NID is set in alc_build_pcms */ |
| 3436 | }; |
| 3437 | |
| 3438 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3439 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3440 | .channels_min = 2, |
| 3441 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3442 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3443 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3444 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3445 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3446 | }, |
| 3447 | }; |
| 3448 | |
| 3449 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3450 | .substreams = 1, |
| 3451 | .channels_min = 2, |
| 3452 | .channels_max = 2, |
| 3453 | /* NID is set in alc_build_pcms */ |
| 3454 | .ops = { |
| 3455 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3456 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3457 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3458 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3459 | }, |
| 3460 | }; |
| 3461 | |
| 3462 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3463 | .substreams = 1, |
| 3464 | .channels_min = 2, |
| 3465 | .channels_max = 2, |
| 3466 | /* NID is set in alc_build_pcms */ |
| 3467 | }; |
| 3468 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3469 | /* 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] | 3470 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3471 | .substreams = 0, |
| 3472 | .channels_min = 0, |
| 3473 | .channels_max = 0, |
| 3474 | }; |
| 3475 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3476 | static int alc_build_pcms(struct hda_codec *codec) |
| 3477 | { |
| 3478 | struct alc_spec *spec = codec->spec; |
| 3479 | struct hda_pcm *info = spec->pcm_rec; |
| 3480 | int i; |
| 3481 | |
| 3482 | codec->num_pcms = 1; |
| 3483 | codec->pcm_info = info; |
| 3484 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3485 | if (spec->no_analog) |
| 3486 | goto skip_analog; |
| 3487 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3488 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 3489 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3490 | info->name = spec->stream_name_analog; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 3491 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3492 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3493 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3494 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3495 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3496 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3497 | } |
| 3498 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3499 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3500 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3501 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3502 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3503 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3504 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3505 | if (spec->channel_mode) { |
| 3506 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3507 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3508 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3509 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3510 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3511 | } |
| 3512 | } |
| 3513 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3514 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3515 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3516 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3517 | snprintf(spec->stream_name_digital, |
| 3518 | sizeof(spec->stream_name_digital), |
| 3519 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3520 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3521 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3522 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3523 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3524 | if (spec->dig_out_type) |
| 3525 | info->pcm_type = spec->dig_out_type; |
| 3526 | else |
| 3527 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3528 | if (spec->multiout.dig_out_nid && |
| 3529 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3530 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3531 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3532 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3533 | if (spec->dig_in_nid && |
| 3534 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3535 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3536 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3537 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3538 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3539 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3540 | } |
| 3541 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3542 | if (spec->no_analog) |
| 3543 | return 0; |
| 3544 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3545 | /* If the use of more than one ADC is requested for the current |
| 3546 | * model, configure a second analog capture-only PCM. |
| 3547 | */ |
| 3548 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3549 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3550 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3551 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3552 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3553 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3554 | if (spec->alt_dac_nid) { |
| 3555 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3556 | *spec->stream_analog_alt_playback; |
| 3557 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3558 | spec->alt_dac_nid; |
| 3559 | } else { |
| 3560 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3561 | alc_pcm_null_stream; |
| 3562 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3563 | } |
| 3564 | if (spec->num_adc_nids > 1) { |
| 3565 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3566 | *spec->stream_analog_alt_capture; |
| 3567 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3568 | spec->adc_nids[1]; |
| 3569 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3570 | spec->num_adc_nids - 1; |
| 3571 | } else { |
| 3572 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3573 | alc_pcm_null_stream; |
| 3574 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3575 | } |
| 3576 | } |
| 3577 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3578 | return 0; |
| 3579 | } |
| 3580 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3581 | static void alc_free_kctls(struct hda_codec *codec) |
| 3582 | { |
| 3583 | struct alc_spec *spec = codec->spec; |
| 3584 | |
| 3585 | if (spec->kctls.list) { |
| 3586 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3587 | int i; |
| 3588 | for (i = 0; i < spec->kctls.used; i++) |
| 3589 | kfree(kctl[i].name); |
| 3590 | } |
| 3591 | snd_array_free(&spec->kctls); |
| 3592 | } |
| 3593 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3594 | static void alc_free(struct hda_codec *codec) |
| 3595 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3596 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3597 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3598 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3599 | return; |
| 3600 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3601 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3602 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3603 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3604 | } |
| 3605 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3606 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3607 | static int alc_resume(struct hda_codec *codec) |
| 3608 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3609 | codec->patch_ops.init(codec); |
| 3610 | snd_hda_codec_resume_amp(codec); |
| 3611 | snd_hda_codec_resume_cache(codec); |
| 3612 | return 0; |
| 3613 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3614 | #endif |
| 3615 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3616 | /* |
| 3617 | */ |
| 3618 | static struct hda_codec_ops alc_patch_ops = { |
| 3619 | .build_controls = alc_build_controls, |
| 3620 | .build_pcms = alc_build_pcms, |
| 3621 | .init = alc_init, |
| 3622 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3623 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3624 | #ifdef SND_HDA_NEEDS_RESUME |
| 3625 | .resume = alc_resume, |
| 3626 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3627 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3628 | .check_power_status = alc_check_power_status, |
| 3629 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3630 | }; |
| 3631 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3632 | |
| 3633 | /* |
| 3634 | * Test configuration for debugging |
| 3635 | * |
| 3636 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3637 | * enum controls. |
| 3638 | */ |
| 3639 | #ifdef CONFIG_SND_DEBUG |
| 3640 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3641 | 0x02, 0x03, 0x04, 0x05 |
| 3642 | }; |
| 3643 | |
| 3644 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3645 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3646 | .items = { |
| 3647 | { "In-1", 0x0 }, |
| 3648 | { "In-2", 0x1 }, |
| 3649 | { "In-3", 0x2 }, |
| 3650 | { "In-4", 0x3 }, |
| 3651 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3652 | { "Front", 0x5 }, |
| 3653 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3654 | }, |
| 3655 | }; |
| 3656 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3657 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3658 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3659 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3660 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3661 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3662 | }; |
| 3663 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3664 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3665 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3666 | { |
| 3667 | static char *texts[] = { |
| 3668 | "N/A", "Line Out", "HP Out", |
| 3669 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3670 | }; |
| 3671 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3672 | uinfo->count = 1; |
| 3673 | uinfo->value.enumerated.items = 8; |
| 3674 | if (uinfo->value.enumerated.item >= 8) |
| 3675 | uinfo->value.enumerated.item = 7; |
| 3676 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3677 | return 0; |
| 3678 | } |
| 3679 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3680 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3681 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3682 | { |
| 3683 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3684 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3685 | unsigned int pin_ctl, item = 0; |
| 3686 | |
| 3687 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3688 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3689 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3690 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3691 | item = 2; |
| 3692 | else |
| 3693 | item = 1; |
| 3694 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3695 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3696 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3697 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3698 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3699 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3700 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3701 | } |
| 3702 | } |
| 3703 | ucontrol->value.enumerated.item[0] = item; |
| 3704 | return 0; |
| 3705 | } |
| 3706 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3707 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3708 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3709 | { |
| 3710 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3711 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3712 | static unsigned int ctls[] = { |
| 3713 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3714 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3715 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3716 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3717 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3718 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3719 | }; |
| 3720 | unsigned int old_ctl, new_ctl; |
| 3721 | |
| 3722 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3723 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3724 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3725 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3726 | int val; |
| 3727 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3728 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3729 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3730 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3731 | HDA_AMP_MUTE : 0; |
| 3732 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3733 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3734 | return 1; |
| 3735 | } |
| 3736 | return 0; |
| 3737 | } |
| 3738 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3739 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3740 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3741 | { |
| 3742 | static char *texts[] = { |
| 3743 | "Front", "Surround", "CLFE", "Side" |
| 3744 | }; |
| 3745 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3746 | uinfo->count = 1; |
| 3747 | uinfo->value.enumerated.items = 4; |
| 3748 | if (uinfo->value.enumerated.item >= 4) |
| 3749 | uinfo->value.enumerated.item = 3; |
| 3750 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3751 | return 0; |
| 3752 | } |
| 3753 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3754 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3755 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3756 | { |
| 3757 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3758 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3759 | unsigned int sel; |
| 3760 | |
| 3761 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3762 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3763 | return 0; |
| 3764 | } |
| 3765 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3766 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3767 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3768 | { |
| 3769 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3770 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3771 | unsigned int sel; |
| 3772 | |
| 3773 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3774 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3775 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3776 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3777 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3778 | return 1; |
| 3779 | } |
| 3780 | return 0; |
| 3781 | } |
| 3782 | |
| 3783 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3784 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3785 | .name = xname, \ |
| 3786 | .info = alc_test_pin_ctl_info, \ |
| 3787 | .get = alc_test_pin_ctl_get, \ |
| 3788 | .put = alc_test_pin_ctl_put, \ |
| 3789 | .private_value = nid \ |
| 3790 | } |
| 3791 | |
| 3792 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3793 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3794 | .name = xname, \ |
| 3795 | .info = alc_test_pin_src_info, \ |
| 3796 | .get = alc_test_pin_src_get, \ |
| 3797 | .put = alc_test_pin_src_put, \ |
| 3798 | .private_value = nid \ |
| 3799 | } |
| 3800 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3801 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3802 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3803 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3804 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3805 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3806 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3807 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3808 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3809 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3810 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3811 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3812 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3813 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3814 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3815 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3816 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3817 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3818 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3819 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3820 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3821 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3822 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3823 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3824 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3825 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3826 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3827 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3828 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3829 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3830 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3831 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3832 | { |
| 3833 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3834 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3835 | .info = alc_ch_mode_info, |
| 3836 | .get = alc_ch_mode_get, |
| 3837 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3838 | }, |
| 3839 | { } /* end */ |
| 3840 | }; |
| 3841 | |
| 3842 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3843 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3844 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3845 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3846 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3847 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3848 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3849 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3850 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3851 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3852 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3853 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3854 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3855 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3856 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3857 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3858 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3859 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3860 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3861 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3862 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3863 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3864 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3865 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3866 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3867 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3868 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3869 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3870 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3871 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3872 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3873 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3874 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3875 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3876 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3877 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3878 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3879 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3880 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3881 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3882 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3883 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3884 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3885 | /* Analog input/passthru */ |
| 3886 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3887 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3888 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3889 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3890 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3891 | { } |
| 3892 | }; |
| 3893 | #endif |
| 3894 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3895 | /* |
| 3896 | */ |
| 3897 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3898 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3899 | [ALC880_3ST] = "3stack", |
| 3900 | [ALC880_TCL_S700] = "tcl", |
| 3901 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3902 | [ALC880_CLEVO] = "clevo", |
| 3903 | [ALC880_5ST] = "5stack", |
| 3904 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3905 | [ALC880_W810] = "w810", |
| 3906 | [ALC880_Z71V] = "z71v", |
| 3907 | [ALC880_6ST] = "6stack", |
| 3908 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3909 | [ALC880_ASUS] = "asus", |
| 3910 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3911 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3912 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3913 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3914 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3915 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3916 | [ALC880_F1734] = "F1734", |
| 3917 | [ALC880_LG] = "lg", |
| 3918 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3919 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3920 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3921 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3922 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3923 | [ALC880_AUTO] = "auto", |
| 3924 | }; |
| 3925 | |
| 3926 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3927 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3928 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3929 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3930 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3931 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3932 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3933 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3934 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3935 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3936 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3937 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3938 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3939 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3940 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3941 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3942 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3943 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3944 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3945 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3946 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3947 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3948 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3949 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3950 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3951 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3952 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3953 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3954 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3955 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3956 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3957 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3958 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3959 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3960 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3961 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3962 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3963 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3964 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3965 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3966 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3967 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3968 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3969 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3970 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3971 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3972 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3973 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3974 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3975 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3976 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3977 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3978 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3979 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3980 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3981 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3982 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3983 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3984 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3985 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3986 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3987 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3988 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3989 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3990 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3991 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3992 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3993 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3994 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3995 | /* default Intel */ |
| 3996 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3997 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3998 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3999 | {} |
| 4000 | }; |
| 4001 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4002 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4003 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4004 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4005 | static struct alc_config_preset alc880_presets[] = { |
| 4006 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4007 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4008 | .init_verbs = { alc880_volume_init_verbs, |
| 4009 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4010 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4011 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4012 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4013 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4014 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4015 | .input_mux = &alc880_capture_source, |
| 4016 | }, |
| 4017 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4018 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4019 | .init_verbs = { alc880_volume_init_verbs, |
| 4020 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4021 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4022 | .dac_nids = alc880_dac_nids, |
| 4023 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4024 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4025 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4026 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4027 | .input_mux = &alc880_capture_source, |
| 4028 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4029 | [ALC880_TCL_S700] = { |
| 4030 | .mixers = { alc880_tcl_s700_mixer }, |
| 4031 | .init_verbs = { alc880_volume_init_verbs, |
| 4032 | alc880_pin_tcl_S700_init_verbs, |
| 4033 | alc880_gpio2_init_verbs }, |
| 4034 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4035 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4036 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4037 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4038 | .hp_nid = 0x03, |
| 4039 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4040 | .channel_mode = alc880_2_jack_modes, |
| 4041 | .input_mux = &alc880_capture_source, |
| 4042 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4043 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4044 | .mixers = { alc880_three_stack_mixer, |
| 4045 | alc880_five_stack_mixer}, |
| 4046 | .init_verbs = { alc880_volume_init_verbs, |
| 4047 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4048 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4049 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4050 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4051 | .channel_mode = alc880_fivestack_modes, |
| 4052 | .input_mux = &alc880_capture_source, |
| 4053 | }, |
| 4054 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4055 | .mixers = { alc880_three_stack_mixer, |
| 4056 | alc880_five_stack_mixer }, |
| 4057 | .init_verbs = { alc880_volume_init_verbs, |
| 4058 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4059 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4060 | .dac_nids = alc880_dac_nids, |
| 4061 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4062 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4063 | .channel_mode = alc880_fivestack_modes, |
| 4064 | .input_mux = &alc880_capture_source, |
| 4065 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4066 | [ALC880_6ST] = { |
| 4067 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4068 | .init_verbs = { alc880_volume_init_verbs, |
| 4069 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4070 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4071 | .dac_nids = alc880_6st_dac_nids, |
| 4072 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4073 | .channel_mode = alc880_sixstack_modes, |
| 4074 | .input_mux = &alc880_6stack_capture_source, |
| 4075 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4076 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4077 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4078 | .init_verbs = { alc880_volume_init_verbs, |
| 4079 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4080 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4081 | .dac_nids = alc880_6st_dac_nids, |
| 4082 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4083 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4084 | .channel_mode = alc880_sixstack_modes, |
| 4085 | .input_mux = &alc880_6stack_capture_source, |
| 4086 | }, |
| 4087 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4088 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4089 | .init_verbs = { alc880_volume_init_verbs, |
| 4090 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4091 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4092 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4093 | .dac_nids = alc880_w810_dac_nids, |
| 4094 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4095 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4096 | .channel_mode = alc880_w810_modes, |
| 4097 | .input_mux = &alc880_capture_source, |
| 4098 | }, |
| 4099 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4100 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4101 | .init_verbs = { alc880_volume_init_verbs, |
| 4102 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4103 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4104 | .dac_nids = alc880_z71v_dac_nids, |
| 4105 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4106 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4107 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4108 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4109 | .input_mux = &alc880_capture_source, |
| 4110 | }, |
| 4111 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4112 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4113 | .init_verbs = { alc880_volume_init_verbs, |
| 4114 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4115 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4116 | .dac_nids = alc880_f1734_dac_nids, |
| 4117 | .hp_nid = 0x02, |
| 4118 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4119 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4120 | .input_mux = &alc880_f1734_capture_source, |
| 4121 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4122 | .setup = alc880_uniwill_p53_setup, |
| 4123 | .init_hook = alc_automute_amp, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4124 | }, |
| 4125 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4126 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4127 | .init_verbs = { alc880_volume_init_verbs, |
| 4128 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4129 | alc880_gpio1_init_verbs }, |
| 4130 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4131 | .dac_nids = alc880_asus_dac_nids, |
| 4132 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4133 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4134 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4135 | .input_mux = &alc880_capture_source, |
| 4136 | }, |
| 4137 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4138 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4139 | .init_verbs = { alc880_volume_init_verbs, |
| 4140 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4141 | alc880_gpio1_init_verbs }, |
| 4142 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4143 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4144 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4145 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4146 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4147 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4148 | .input_mux = &alc880_capture_source, |
| 4149 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4150 | [ALC880_ASUS_DIG2] = { |
| 4151 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4152 | .init_verbs = { alc880_volume_init_verbs, |
| 4153 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4154 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4155 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4156 | .dac_nids = alc880_asus_dac_nids, |
| 4157 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4158 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4159 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4160 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4161 | .input_mux = &alc880_capture_source, |
| 4162 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4163 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4164 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4165 | .init_verbs = { alc880_volume_init_verbs, |
| 4166 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4167 | alc880_gpio1_init_verbs }, |
| 4168 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4169 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4170 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4171 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4172 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4173 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4174 | .input_mux = &alc880_capture_source, |
| 4175 | }, |
| 4176 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4177 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4178 | .init_verbs = { alc880_volume_init_verbs, |
| 4179 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4180 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4181 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4182 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4183 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4184 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4185 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4186 | .input_mux = &alc880_capture_source, |
| 4187 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4188 | [ALC880_UNIWILL] = { |
| 4189 | .mixers = { alc880_uniwill_mixer }, |
| 4190 | .init_verbs = { alc880_volume_init_verbs, |
| 4191 | alc880_uniwill_init_verbs }, |
| 4192 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4193 | .dac_nids = alc880_asus_dac_nids, |
| 4194 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4195 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4196 | .channel_mode = alc880_threestack_modes, |
| 4197 | .need_dac_fix = 1, |
| 4198 | .input_mux = &alc880_capture_source, |
| 4199 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4200 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4201 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4202 | }, |
| 4203 | [ALC880_UNIWILL_P53] = { |
| 4204 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4205 | .init_verbs = { alc880_volume_init_verbs, |
| 4206 | alc880_uniwill_p53_init_verbs }, |
| 4207 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4208 | .dac_nids = alc880_asus_dac_nids, |
| 4209 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4210 | .channel_mode = alc880_threestack_modes, |
| 4211 | .input_mux = &alc880_capture_source, |
| 4212 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4213 | .setup = alc880_uniwill_p53_setup, |
| 4214 | .init_hook = alc_automute_amp, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4215 | }, |
| 4216 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4217 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4218 | .init_verbs = { alc880_volume_init_verbs, |
| 4219 | alc880_uniwill_p53_init_verbs, |
| 4220 | alc880_beep_init_verbs }, |
| 4221 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4222 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4223 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4224 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4225 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4226 | .input_mux = &alc880_capture_source, |
| 4227 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4228 | .setup = alc880_uniwill_p53_setup, |
| 4229 | .init_hook = alc_automute_amp, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4230 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4231 | [ALC880_CLEVO] = { |
| 4232 | .mixers = { alc880_three_stack_mixer }, |
| 4233 | .init_verbs = { alc880_volume_init_verbs, |
| 4234 | alc880_pin_clevo_init_verbs }, |
| 4235 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4236 | .dac_nids = alc880_dac_nids, |
| 4237 | .hp_nid = 0x03, |
| 4238 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4239 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4240 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4241 | .input_mux = &alc880_capture_source, |
| 4242 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4243 | [ALC880_LG] = { |
| 4244 | .mixers = { alc880_lg_mixer }, |
| 4245 | .init_verbs = { alc880_volume_init_verbs, |
| 4246 | alc880_lg_init_verbs }, |
| 4247 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4248 | .dac_nids = alc880_lg_dac_nids, |
| 4249 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4250 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4251 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4252 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4253 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4254 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4255 | .setup = alc880_lg_setup, |
| 4256 | .init_hook = alc_automute_amp, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4257 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4258 | .loopbacks = alc880_lg_loopbacks, |
| 4259 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4260 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4261 | [ALC880_LG_LW] = { |
| 4262 | .mixers = { alc880_lg_lw_mixer }, |
| 4263 | .init_verbs = { alc880_volume_init_verbs, |
| 4264 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4265 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4266 | .dac_nids = alc880_dac_nids, |
| 4267 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4268 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4269 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4270 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4271 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4272 | .setup = alc880_lg_lw_setup, |
| 4273 | .init_hook = alc_automute_amp, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4274 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4275 | [ALC880_MEDION_RIM] = { |
| 4276 | .mixers = { alc880_medion_rim_mixer }, |
| 4277 | .init_verbs = { alc880_volume_init_verbs, |
| 4278 | alc880_medion_rim_init_verbs, |
| 4279 | alc_gpio2_init_verbs }, |
| 4280 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4281 | .dac_nids = alc880_dac_nids, |
| 4282 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4283 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4284 | .channel_mode = alc880_2_jack_modes, |
| 4285 | .input_mux = &alc880_medion_rim_capture_source, |
| 4286 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4287 | .setup = alc880_medion_rim_setup, |
| 4288 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4289 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4290 | #ifdef CONFIG_SND_DEBUG |
| 4291 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4292 | .mixers = { alc880_test_mixer }, |
| 4293 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4294 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4295 | .dac_nids = alc880_test_dac_nids, |
| 4296 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4297 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4298 | .channel_mode = alc880_test_modes, |
| 4299 | .input_mux = &alc880_test_capture_source, |
| 4300 | }, |
| 4301 | #endif |
| 4302 | }; |
| 4303 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4304 | /* |
| 4305 | * Automatic parse of I/O pins from the BIOS configuration |
| 4306 | */ |
| 4307 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4308 | enum { |
| 4309 | ALC_CTL_WIDGET_VOL, |
| 4310 | ALC_CTL_WIDGET_MUTE, |
| 4311 | ALC_CTL_BIND_MUTE, |
| 4312 | }; |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4313 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4314 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4315 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4316 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4317 | }; |
| 4318 | |
| 4319 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4320 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 4321 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4322 | { |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4323 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4324 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4325 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4326 | knew = snd_array_new(&spec->kctls); |
| 4327 | if (!knew) |
| 4328 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4329 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4330 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4331 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4332 | return -ENOMEM; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 4333 | if (get_amp_nid_(val)) |
Takashi Iwai | 9c96fa5 | 2009-11-16 11:25:33 +0100 | [diff] [blame] | 4334 | knew->subdevice = HDA_SUBDEV_NID_FLAG | get_amp_nid_(val); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4335 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4336 | return 0; |
| 4337 | } |
| 4338 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4339 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 4340 | const char *pfx, const char *dir, |
| 4341 | const char *sfx, unsigned long val) |
| 4342 | { |
| 4343 | char name[32]; |
| 4344 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
| 4345 | return add_control(spec, type, name, val); |
| 4346 | } |
| 4347 | |
| 4348 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 4349 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val) |
| 4350 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 4351 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val) |
| 4352 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4353 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4354 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4355 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4356 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4357 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4358 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4359 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4360 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4361 | #define ALC880_PIN_CD_NID 0x1c |
| 4362 | |
| 4363 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4364 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4365 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4366 | { |
| 4367 | hda_nid_t nid; |
| 4368 | int assigned[4]; |
| 4369 | int i, j; |
| 4370 | |
| 4371 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4372 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4373 | |
| 4374 | /* check the pins hardwired to audio widget */ |
| 4375 | for (i = 0; i < cfg->line_outs; i++) { |
| 4376 | nid = cfg->line_out_pins[i]; |
| 4377 | if (alc880_is_fixed_pin(nid)) { |
| 4378 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4379 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4380 | assigned[idx] = 1; |
| 4381 | } |
| 4382 | } |
| 4383 | /* left pins can be connect to any audio widget */ |
| 4384 | for (i = 0; i < cfg->line_outs; i++) { |
| 4385 | nid = cfg->line_out_pins[i]; |
| 4386 | if (alc880_is_fixed_pin(nid)) |
| 4387 | continue; |
| 4388 | /* search for an empty channel */ |
| 4389 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4390 | if (!assigned[j]) { |
| 4391 | spec->multiout.dac_nids[i] = |
| 4392 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4393 | assigned[j] = 1; |
| 4394 | break; |
| 4395 | } |
| 4396 | } |
| 4397 | } |
| 4398 | spec->multiout.num_dacs = cfg->line_outs; |
| 4399 | return 0; |
| 4400 | } |
| 4401 | |
| 4402 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4403 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4404 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4405 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4406 | static const char *chname[4] = { |
| 4407 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4408 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4409 | hda_nid_t nid; |
| 4410 | int i, err; |
| 4411 | |
| 4412 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4413 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4414 | continue; |
| 4415 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4416 | if (i == 2) { |
| 4417 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4418 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 4419 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4420 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4421 | HDA_OUTPUT)); |
| 4422 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4423 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4424 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 4425 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4426 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4427 | HDA_OUTPUT)); |
| 4428 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4429 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4430 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 4431 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4432 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4433 | HDA_INPUT)); |
| 4434 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4435 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4436 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 4437 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4438 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4439 | HDA_INPUT)); |
| 4440 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4441 | return err; |
| 4442 | } else { |
Takashi Iwai | cb162b6 | 2009-08-25 16:05:03 +0200 | [diff] [blame] | 4443 | const char *pfx; |
| 4444 | if (cfg->line_outs == 1 && |
| 4445 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 4446 | pfx = "Speaker"; |
| 4447 | else |
| 4448 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4449 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4450 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4451 | HDA_OUTPUT)); |
| 4452 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4453 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4454 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4455 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4456 | HDA_INPUT)); |
| 4457 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4458 | return err; |
| 4459 | } |
| 4460 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4461 | return 0; |
| 4462 | } |
| 4463 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4464 | /* add playback controls for speaker and HP outputs */ |
| 4465 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4466 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4467 | { |
| 4468 | hda_nid_t nid; |
| 4469 | int err; |
| 4470 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4471 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4472 | return 0; |
| 4473 | |
| 4474 | if (alc880_is_fixed_pin(pin)) { |
| 4475 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4476 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4477 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4478 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4479 | else |
| 4480 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4481 | /* control HP volume/switch on the output mixer amp */ |
| 4482 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4483 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4484 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4485 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4486 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4487 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4488 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4489 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4490 | return err; |
| 4491 | } else if (alc880_is_multi_pin(pin)) { |
| 4492 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4493 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4494 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4495 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4496 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4497 | return err; |
| 4498 | } |
| 4499 | return 0; |
| 4500 | } |
| 4501 | |
| 4502 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4503 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4504 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4505 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4506 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4507 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4508 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4509 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4510 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4511 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4512 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4513 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4514 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4515 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4516 | return err; |
| 4517 | return 0; |
| 4518 | } |
| 4519 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4520 | 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] | 4521 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4522 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 4523 | return (pincap & AC_PINCAP_IN) != 0; |
| 4524 | } |
| 4525 | |
| 4526 | /* create playback/capture controls for input pins */ |
| 4527 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 4528 | const struct auto_pin_cfg *cfg, |
| 4529 | hda_nid_t mixer, |
| 4530 | hda_nid_t cap1, hda_nid_t cap2) |
| 4531 | { |
| 4532 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4533 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4534 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4535 | |
| 4536 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4537 | hda_nid_t pin; |
| 4538 | |
| 4539 | pin = cfg->input_pins[i]; |
| 4540 | if (!alc_is_input_pin(codec, pin)) |
| 4541 | continue; |
| 4542 | |
| 4543 | if (mixer) { |
| 4544 | idx = get_connection_index(codec, mixer, pin); |
| 4545 | if (idx >= 0) { |
| 4546 | err = new_analog_input(spec, pin, |
| 4547 | auto_pin_cfg_labels[i], |
| 4548 | idx, mixer); |
| 4549 | if (err < 0) |
| 4550 | return err; |
| 4551 | } |
| 4552 | } |
| 4553 | |
| 4554 | if (!cap1) |
| 4555 | continue; |
| 4556 | idx = get_connection_index(codec, cap1, pin); |
| 4557 | if (idx < 0 && cap2) |
| 4558 | idx = get_connection_index(codec, cap2, pin); |
| 4559 | if (idx >= 0) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4560 | imux->items[imux->num_items].label = |
| 4561 | auto_pin_cfg_labels[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4562 | imux->items[imux->num_items].index = idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4563 | imux->num_items++; |
| 4564 | } |
| 4565 | } |
| 4566 | return 0; |
| 4567 | } |
| 4568 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4569 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 4570 | const struct auto_pin_cfg *cfg) |
| 4571 | { |
| 4572 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 4573 | } |
| 4574 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4575 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4576 | unsigned int pin_type) |
| 4577 | { |
| 4578 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4579 | pin_type); |
| 4580 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4581 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4582 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4583 | } |
| 4584 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4585 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4586 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4587 | int dac_idx) |
| 4588 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4589 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4590 | /* need the manual connection? */ |
| 4591 | if (alc880_is_multi_pin(nid)) { |
| 4592 | struct alc_spec *spec = codec->spec; |
| 4593 | int idx = alc880_multi_pin_idx(nid); |
| 4594 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4595 | AC_VERB_SET_CONNECT_SEL, |
| 4596 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4597 | } |
| 4598 | } |
| 4599 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4600 | static int get_pin_type(int line_out_type) |
| 4601 | { |
| 4602 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4603 | return PIN_HP; |
| 4604 | else |
| 4605 | return PIN_OUT; |
| 4606 | } |
| 4607 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4608 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4609 | { |
| 4610 | struct alc_spec *spec = codec->spec; |
| 4611 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4612 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4613 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4614 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4615 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4616 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4617 | } |
| 4618 | } |
| 4619 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4620 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4621 | { |
| 4622 | struct alc_spec *spec = codec->spec; |
| 4623 | hda_nid_t pin; |
| 4624 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4625 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4626 | if (pin) /* connect to front */ |
| 4627 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4628 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4629 | if (pin) /* connect to front */ |
| 4630 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4631 | } |
| 4632 | |
| 4633 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4634 | { |
| 4635 | struct alc_spec *spec = codec->spec; |
| 4636 | int i; |
| 4637 | |
| 4638 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4639 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4640 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 4641 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 4642 | if (nid != ALC880_PIN_CD_NID && |
| 4643 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4644 | snd_hda_codec_write(codec, nid, 0, |
| 4645 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4646 | AMP_OUT_MUTE); |
| 4647 | } |
| 4648 | } |
| 4649 | } |
| 4650 | |
| 4651 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4652 | /* return 1 if successful, 0 if the proper config is not found, |
| 4653 | * or a negative error code |
| 4654 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4655 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4656 | { |
| 4657 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4658 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4659 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4660 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4661 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4662 | alc880_ignore); |
| 4663 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4664 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4665 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4666 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4667 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4668 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4669 | if (err < 0) |
| 4670 | return err; |
| 4671 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4672 | if (err < 0) |
| 4673 | return err; |
| 4674 | err = alc880_auto_create_extra_out(spec, |
| 4675 | spec->autocfg.speaker_pins[0], |
| 4676 | "Speaker"); |
| 4677 | if (err < 0) |
| 4678 | return err; |
| 4679 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4680 | "Headphone"); |
| 4681 | if (err < 0) |
| 4682 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4683 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4684 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4685 | return err; |
| 4686 | |
| 4687 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4688 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4689 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4690 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4691 | hda_nid_t dig_nid; |
| 4692 | err = snd_hda_get_connections(codec, |
| 4693 | spec->autocfg.dig_out_pins[i], |
| 4694 | &dig_nid, 1); |
| 4695 | if (err < 0) |
| 4696 | continue; |
| 4697 | if (!i) |
| 4698 | spec->multiout.dig_out_nid = dig_nid; |
| 4699 | else { |
| 4700 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 4701 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4702 | break; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 4703 | spec->slave_dig_outs[i - 1] = dig_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4704 | } |
| 4705 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4706 | if (spec->autocfg.dig_in_pin) |
| 4707 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4708 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4709 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4710 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4711 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4712 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4713 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4714 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4715 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4716 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 4717 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 4718 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4719 | return 1; |
| 4720 | } |
| 4721 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4722 | /* additional initialization for auto-configuration model */ |
| 4723 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4724 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4725 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4726 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4727 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4728 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4729 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4730 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4731 | } |
| 4732 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4733 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 4734 | * one of two digital mic pins, e.g. on ALC272 |
| 4735 | */ |
| 4736 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4737 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4738 | struct alc_spec *spec = codec->spec; |
| 4739 | int i; |
| 4740 | |
| 4741 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 4742 | hda_nid_t cap = spec->capsrc_nids ? |
| 4743 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 4744 | int iidx, eidx; |
| 4745 | |
| 4746 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 4747 | if (iidx < 0) |
| 4748 | continue; |
| 4749 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 4750 | if (eidx < 0) |
| 4751 | continue; |
| 4752 | spec->int_mic.mux_idx = iidx; |
| 4753 | spec->ext_mic.mux_idx = eidx; |
| 4754 | if (spec->capsrc_nids) |
| 4755 | spec->capsrc_nids += i; |
| 4756 | spec->adc_nids += i; |
| 4757 | spec->num_adc_nids = 1; |
| 4758 | return; |
| 4759 | } |
| 4760 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 4761 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 4762 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 4763 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 4764 | } |
| 4765 | |
| 4766 | static void set_capture_mixer(struct hda_codec *codec) |
| 4767 | { |
| 4768 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4769 | static struct snd_kcontrol_new *caps[2][3] = { |
| 4770 | { alc_capture_mixer_nosrc1, |
| 4771 | alc_capture_mixer_nosrc2, |
| 4772 | alc_capture_mixer_nosrc3 }, |
| 4773 | { alc_capture_mixer1, |
| 4774 | alc_capture_mixer2, |
| 4775 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4776 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4777 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
| 4778 | int mux; |
Takashi Iwai | 2a22d3f | 2009-08-10 18:54:38 +0200 | [diff] [blame] | 4779 | if (spec->auto_mic) { |
| 4780 | mux = 0; |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4781 | fixup_automic_adc(codec); |
Takashi Iwai | 2a22d3f | 2009-08-10 18:54:38 +0200 | [diff] [blame] | 4782 | } else if (spec->input_mux && spec->input_mux->num_items > 1) |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4783 | mux = 1; |
| 4784 | else |
| 4785 | mux = 0; |
| 4786 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; |
| 4787 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4788 | } |
| 4789 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 4790 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4791 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 4792 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 4793 | #else |
| 4794 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
| 4795 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4796 | |
| 4797 | /* |
| 4798 | * OK, here we have finally the patch for ALC880 |
| 4799 | */ |
| 4800 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4801 | static int patch_alc880(struct hda_codec *codec) |
| 4802 | { |
| 4803 | struct alc_spec *spec; |
| 4804 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4805 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4806 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4807 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4808 | if (spec == NULL) |
| 4809 | return -ENOMEM; |
| 4810 | |
| 4811 | codec->spec = spec; |
| 4812 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4813 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 4814 | alc880_models, |
| 4815 | alc880_cfg_tbl); |
| 4816 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 4817 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 4818 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4819 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4820 | } |
| 4821 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4822 | if (board_config == ALC880_AUTO) { |
| 4823 | /* automatic parse from the BIOS config */ |
| 4824 | err = alc880_parse_auto_config(codec); |
| 4825 | if (err < 0) { |
| 4826 | alc_free(codec); |
| 4827 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4828 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4829 | printk(KERN_INFO |
| 4830 | "hda_codec: Cannot set up configuration " |
| 4831 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4832 | board_config = ALC880_3ST; |
| 4833 | } |
| 4834 | } |
| 4835 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4836 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 4837 | if (err < 0) { |
| 4838 | alc_free(codec); |
| 4839 | return err; |
| 4840 | } |
| 4841 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4842 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 4843 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4844 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4845 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 4846 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4847 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4848 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4849 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 4850 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 4851 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4852 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4853 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 4854 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4855 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 4856 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4857 | if (wcap != AC_WID_AUD_IN) { |
| 4858 | spec->adc_nids = alc880_adc_nids_alt; |
| 4859 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4860 | } else { |
| 4861 | spec->adc_nids = alc880_adc_nids; |
| 4862 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4863 | } |
| 4864 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4865 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4866 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4867 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 4868 | spec->vmaster_nid = 0x0c; |
| 4869 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4870 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4871 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4872 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4873 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4874 | if (!spec->loopback.amplist) |
| 4875 | spec->loopback.amplist = alc880_loopbacks; |
| 4876 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 4877 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4878 | |
| 4879 | return 0; |
| 4880 | } |
| 4881 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4882 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4883 | /* |
| 4884 | * ALC260 support |
| 4885 | */ |
| 4886 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4887 | static hda_nid_t alc260_dac_nids[1] = { |
| 4888 | /* front */ |
| 4889 | 0x02, |
| 4890 | }; |
| 4891 | |
| 4892 | static hda_nid_t alc260_adc_nids[1] = { |
| 4893 | /* ADC0 */ |
| 4894 | 0x04, |
| 4895 | }; |
| 4896 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4897 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4898 | /* ADC1 */ |
| 4899 | 0x05, |
| 4900 | }; |
| 4901 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4902 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4903 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4904 | */ |
| 4905 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4906 | /* ADC0, ADC1 */ |
| 4907 | 0x04, 0x05 |
| 4908 | }; |
| 4909 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4910 | #define ALC260_DIGOUT_NID 0x03 |
| 4911 | #define ALC260_DIGIN_NID 0x06 |
| 4912 | |
| 4913 | static struct hda_input_mux alc260_capture_source = { |
| 4914 | .num_items = 4, |
| 4915 | .items = { |
| 4916 | { "Mic", 0x0 }, |
| 4917 | { "Front Mic", 0x1 }, |
| 4918 | { "Line", 0x2 }, |
| 4919 | { "CD", 0x4 }, |
| 4920 | }, |
| 4921 | }; |
| 4922 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4923 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4924 | * headphone jack and the internal CD lines since these are the only pins at |
| 4925 | * which audio can appear. For flexibility, also allow the option of |
| 4926 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4927 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4928 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4929 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4930 | { |
| 4931 | .num_items = 3, |
| 4932 | .items = { |
| 4933 | { "Mic/Line", 0x0 }, |
| 4934 | { "CD", 0x4 }, |
| 4935 | { "Headphone", 0x2 }, |
| 4936 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4937 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4938 | { |
| 4939 | .num_items = 4, |
| 4940 | .items = { |
| 4941 | { "Mic/Line", 0x0 }, |
| 4942 | { "CD", 0x4 }, |
| 4943 | { "Headphone", 0x2 }, |
| 4944 | { "Mixer", 0x5 }, |
| 4945 | }, |
| 4946 | }, |
| 4947 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4948 | }; |
| 4949 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4950 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 4951 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4952 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4953 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 4954 | { |
| 4955 | .num_items = 4, |
| 4956 | .items = { |
| 4957 | { "Mic", 0x0 }, |
| 4958 | { "Line", 0x2 }, |
| 4959 | { "CD", 0x4 }, |
| 4960 | { "Headphone", 0x5 }, |
| 4961 | }, |
| 4962 | }, |
| 4963 | { |
| 4964 | .num_items = 5, |
| 4965 | .items = { |
| 4966 | { "Mic", 0x0 }, |
| 4967 | { "Line", 0x2 }, |
| 4968 | { "CD", 0x4 }, |
| 4969 | { "Headphone", 0x6 }, |
| 4970 | { "Mixer", 0x5 }, |
| 4971 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4972 | }, |
| 4973 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 4974 | |
| 4975 | /* Maxdata Favorit 100XS */ |
| 4976 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 4977 | { |
| 4978 | .num_items = 2, |
| 4979 | .items = { |
| 4980 | { "Line/Mic", 0x0 }, |
| 4981 | { "CD", 0x4 }, |
| 4982 | }, |
| 4983 | }, |
| 4984 | { |
| 4985 | .num_items = 3, |
| 4986 | .items = { |
| 4987 | { "Line/Mic", 0x0 }, |
| 4988 | { "CD", 0x4 }, |
| 4989 | { "Mixer", 0x5 }, |
| 4990 | }, |
| 4991 | }, |
| 4992 | }; |
| 4993 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4994 | /* |
| 4995 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 4996 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 4997 | * element which allows changing the channel mode, so the verb list is |
| 4998 | * never used. |
| 4999 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5000 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5001 | { 2, NULL }, |
| 5002 | }; |
| 5003 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5004 | |
| 5005 | /* Mixer combinations |
| 5006 | * |
| 5007 | * basic: base_output + input + pc_beep + capture |
| 5008 | * HP: base_output + input + capture_alt |
| 5009 | * HP_3013: hp_3013 + input + capture |
| 5010 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5011 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5012 | */ |
| 5013 | |
| 5014 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5015 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5016 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5017 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5018 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5019 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5020 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5021 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5022 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5023 | |
| 5024 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5025 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5026 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5027 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5028 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5029 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5030 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5031 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5032 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5033 | { } /* end */ |
| 5034 | }; |
| 5035 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5036 | /* update HP, line and mono out pins according to the master switch */ |
| 5037 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 5038 | hda_nid_t hp, hda_nid_t line, |
| 5039 | hda_nid_t mono) |
| 5040 | { |
| 5041 | struct alc_spec *spec = codec->spec; |
| 5042 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 5043 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5044 | 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] | 5045 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5046 | 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] | 5047 | val); |
| 5048 | /* mono (speaker) depending on the HP jack sense */ |
| 5049 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5050 | 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] | 5051 | val); |
| 5052 | } |
| 5053 | |
| 5054 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 5055 | struct snd_ctl_elem_value *ucontrol) |
| 5056 | { |
| 5057 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5058 | struct alc_spec *spec = codec->spec; |
| 5059 | *ucontrol->value.integer.value = spec->master_sw; |
| 5060 | return 0; |
| 5061 | } |
| 5062 | |
| 5063 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 5064 | struct snd_ctl_elem_value *ucontrol) |
| 5065 | { |
| 5066 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5067 | struct alc_spec *spec = codec->spec; |
| 5068 | int val = !!*ucontrol->value.integer.value; |
| 5069 | hda_nid_t hp, line, mono; |
| 5070 | |
| 5071 | if (val == spec->master_sw) |
| 5072 | return 0; |
| 5073 | spec->master_sw = val; |
| 5074 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 5075 | line = (kcontrol->private_value >> 8) & 0xff; |
| 5076 | mono = kcontrol->private_value & 0xff; |
| 5077 | alc260_hp_master_update(codec, hp, line, mono); |
| 5078 | return 1; |
| 5079 | } |
| 5080 | |
| 5081 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 5082 | { |
| 5083 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5084 | .name = "Master Playback Switch", |
| 5085 | .info = snd_ctl_boolean_mono_info, |
| 5086 | .get = alc260_hp_master_sw_get, |
| 5087 | .put = alc260_hp_master_sw_put, |
| 5088 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 5089 | }, |
| 5090 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5091 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 5092 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5093 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5094 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 5095 | HDA_OUTPUT), |
| 5096 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5097 | { } /* end */ |
| 5098 | }; |
| 5099 | |
| 5100 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 5101 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5102 | {}, |
| 5103 | }; |
| 5104 | |
| 5105 | static void alc260_hp_automute(struct hda_codec *codec) |
| 5106 | { |
| 5107 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5108 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5109 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5110 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 5111 | } |
| 5112 | |
| 5113 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5114 | { |
| 5115 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5116 | alc260_hp_automute(codec); |
| 5117 | } |
| 5118 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5119 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5120 | { |
| 5121 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5122 | .name = "Master Playback Switch", |
| 5123 | .info = snd_ctl_boolean_mono_info, |
| 5124 | .get = alc260_hp_master_sw_get, |
| 5125 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5126 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5127 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5128 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5129 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5130 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5131 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5132 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5133 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 5134 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5135 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5136 | { } /* end */ |
| 5137 | }; |
| 5138 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5139 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 5140 | .ops = &snd_hda_bind_vol, |
| 5141 | .values = { |
| 5142 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 5143 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 5144 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 5145 | 0 |
| 5146 | }, |
| 5147 | }; |
| 5148 | |
| 5149 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 5150 | .ops = &snd_hda_bind_sw, |
| 5151 | .values = { |
| 5152 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 5153 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 5154 | 0 |
| 5155 | }, |
| 5156 | }; |
| 5157 | |
| 5158 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 5159 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 5160 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 5161 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 5162 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5163 | { } /* end */ |
| 5164 | }; |
| 5165 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5166 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 5167 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5168 | {}, |
| 5169 | }; |
| 5170 | |
| 5171 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 5172 | { |
| 5173 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5174 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5175 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5176 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5177 | } |
| 5178 | |
| 5179 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 5180 | unsigned int res) |
| 5181 | { |
| 5182 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5183 | alc260_hp_3013_automute(codec); |
| 5184 | } |
| 5185 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5186 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 5187 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5188 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5189 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5190 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5191 | bits); |
| 5192 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5193 | bits); |
| 5194 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5195 | bits); |
| 5196 | } |
| 5197 | |
| 5198 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 5199 | unsigned int res) |
| 5200 | { |
| 5201 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5202 | alc260_hp_3012_automute(codec); |
| 5203 | } |
| 5204 | |
| 5205 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5206 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 5207 | */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5208 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5209 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5210 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5211 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5212 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5213 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5214 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5215 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5216 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5217 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5218 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5219 | { } /* end */ |
| 5220 | }; |
| 5221 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5222 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 5223 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 5224 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 5225 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 5226 | * whether this behaviour is intentional or is a hardware bug in chip |
| 5227 | * revisions available in early 2006. Therefore for now allow the |
| 5228 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 5229 | * that the lack of mic bias for this NID is intentional we could change the |
| 5230 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5231 | * |
| 5232 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 5233 | * don't appear to make the mic bias available from the "line" jack, even |
| 5234 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 5235 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 5236 | * and the output jack. If this turns out to be the case for all such |
| 5237 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 5238 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5239 | * |
| 5240 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 5241 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 5242 | * controls for such models. On models without a "mono speaker" the control |
| 5243 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5244 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5245 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 5246 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5247 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5248 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5249 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5250 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5251 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5252 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5253 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5254 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5255 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5256 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5257 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5258 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5259 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5260 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5261 | { } /* end */ |
| 5262 | }; |
| 5263 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5264 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 5265 | */ |
| 5266 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 5267 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5268 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 5269 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5270 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5271 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5272 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5273 | { } /* end */ |
| 5274 | }; |
| 5275 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5276 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 5277 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 5278 | */ |
| 5279 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 5280 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5281 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5282 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5283 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5284 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5285 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5286 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5287 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5288 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5289 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5290 | { } /* end */ |
| 5291 | }; |
| 5292 | |
| 5293 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 5294 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 5295 | */ |
| 5296 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 5297 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5298 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5299 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5300 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5301 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5302 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 5303 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 5304 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5305 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5306 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5307 | { } /* end */ |
| 5308 | }; |
| 5309 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5310 | /* |
| 5311 | * initialization verbs |
| 5312 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5313 | static struct hda_verb alc260_init_verbs[] = { |
| 5314 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5315 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5316 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5317 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5318 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5319 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5320 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5321 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5322 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5323 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5324 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 5325 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5326 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5327 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5328 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5329 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5330 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5331 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5332 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5333 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5334 | /* set connection select to line in (default select for this ADC) */ |
| 5335 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5336 | /* mute capture amp left and right */ |
| 5337 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5338 | /* set connection select to line in (default select for this ADC) */ |
| 5339 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5340 | /* set vol=0 Line-Out mixer amp left and right */ |
| 5341 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5342 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5343 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5344 | /* set vol=0 HP mixer amp left and right */ |
| 5345 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5346 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5347 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5348 | /* set vol=0 Mono mixer amp left and right */ |
| 5349 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5350 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5351 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5352 | /* unmute LINE-2 out pin */ |
| 5353 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5354 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5355 | * Line In 2 = 0x03 |
| 5356 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5357 | /* mute analog inputs */ |
| 5358 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5359 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5360 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5361 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5362 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5363 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5364 | /* mute Front out path */ |
| 5365 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5366 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5367 | /* mute Headphone out path */ |
| 5368 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5369 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5370 | /* mute Mono out path */ |
| 5371 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5372 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5373 | { } |
| 5374 | }; |
| 5375 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5376 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5377 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 5378 | /* Headphone and output */ |
| 5379 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5380 | /* mono output */ |
| 5381 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5382 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5383 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5384 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5385 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5386 | /* Line In pin widget for input */ |
| 5387 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5388 | /* Line-2 pin widget for output */ |
| 5389 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5390 | /* CD pin widget for input */ |
| 5391 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5392 | /* unmute amp left and right */ |
| 5393 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5394 | /* set connection select to line in (default select for this ADC) */ |
| 5395 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5396 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5397 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5398 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5399 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5400 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5401 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5402 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5403 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5404 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5405 | * Line In 2 = 0x03 |
| 5406 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5407 | /* mute analog inputs */ |
| 5408 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5409 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5410 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5411 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5412 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5413 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5414 | /* Unmute Front out path */ |
| 5415 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5416 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5417 | /* Unmute Headphone out path */ |
| 5418 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5419 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5420 | /* Unmute Mono out path */ |
| 5421 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5422 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5423 | { } |
| 5424 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5425 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5426 | |
| 5427 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5428 | /* Line out and output */ |
| 5429 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5430 | /* mono output */ |
| 5431 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5432 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5433 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5434 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5435 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5436 | /* Line In pin widget for input */ |
| 5437 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5438 | /* Headphone pin widget for output */ |
| 5439 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5440 | /* CD pin widget for input */ |
| 5441 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5442 | /* unmute amp left and right */ |
| 5443 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5444 | /* set connection select to line in (default select for this ADC) */ |
| 5445 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5446 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5447 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5448 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5449 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5450 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5451 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5452 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5453 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5454 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5455 | * Line In 2 = 0x03 |
| 5456 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5457 | /* mute analog inputs */ |
| 5458 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5459 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5460 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5461 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5462 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5463 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5464 | /* Unmute Front out path */ |
| 5465 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5466 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5467 | /* Unmute Headphone out path */ |
| 5468 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5469 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5470 | /* Unmute Mono out path */ |
| 5471 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5472 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5473 | { } |
| 5474 | }; |
| 5475 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5476 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5477 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5478 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5479 | */ |
| 5480 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5481 | /* Disable all GPIOs */ |
| 5482 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5483 | /* Internal speaker is connected to headphone pin */ |
| 5484 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5485 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5486 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5487 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5488 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5489 | /* Ensure all other unused pins are disabled and muted. */ |
| 5490 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5491 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5492 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5493 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5494 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5495 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5496 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5497 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5498 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5499 | /* Disable digital (SPDIF) pins */ |
| 5500 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5501 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5502 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5503 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5504 | * when acting as an output. |
| 5505 | */ |
| 5506 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5507 | |
| 5508 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5509 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5510 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5511 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5512 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5513 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5514 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5515 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5516 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5517 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5518 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5519 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5520 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5521 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5522 | * If the pin mode is changed by the user the pin mode control will |
| 5523 | * take care of enabling the pin's input/output buffers as needed. |
| 5524 | * Therefore there's no need to enable the input buffer at this |
| 5525 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5526 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5527 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5528 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5529 | * mixer ctrl) |
| 5530 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5531 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5532 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5533 | /* Mute capture amp left and right */ |
| 5534 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5535 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5536 | * in (on mic1 pin) |
| 5537 | */ |
| 5538 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5539 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5540 | /* Do the same for the second ADC: mute capture input amp and |
| 5541 | * set ADC connection to line in (on mic1 pin) |
| 5542 | */ |
| 5543 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5544 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5545 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5546 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5547 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5548 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5549 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5550 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5551 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5552 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5553 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5554 | {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] | 5555 | |
| 5556 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5557 | }; |
| 5558 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5559 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5560 | * similar laptops (adapted from Fujitsu init verbs). |
| 5561 | */ |
| 5562 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5563 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5564 | * the headphone jack. Turn this on and rely on the standard mute |
| 5565 | * methods whenever the user wants to turn these outputs off. |
| 5566 | */ |
| 5567 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5568 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5569 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5570 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5571 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5572 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5573 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5574 | /* Line In jack is connected to Line1 pin */ |
| 5575 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5576 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5577 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5578 | /* Ensure all other unused pins are disabled and muted. */ |
| 5579 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5580 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5581 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5582 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5583 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5584 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5585 | /* Disable digital (SPDIF) pins */ |
| 5586 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5587 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5588 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5589 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5590 | * bus when acting as outputs. |
| 5591 | */ |
| 5592 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5593 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5594 | |
| 5595 | /* Start with output sum widgets muted and their output gains at min */ |
| 5596 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5597 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5598 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5599 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5600 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5601 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5602 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5603 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5604 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5605 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5606 | /* Unmute Line-out pin widget amp left and right |
| 5607 | * (no equiv mixer ctrl) |
| 5608 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5609 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5610 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5611 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5612 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5613 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5614 | * will take care of enabling the pin's input/output buffers as needed. |
| 5615 | * Therefore there's no need to enable the input buffer at this |
| 5616 | * stage. |
| 5617 | */ |
| 5618 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5619 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5620 | |
| 5621 | /* Mute capture amp left and right */ |
| 5622 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5623 | /* Set ADC connection select to match default mixer setting - mic |
| 5624 | * (on mic1 pin) |
| 5625 | */ |
| 5626 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5627 | |
| 5628 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5629 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5630 | */ |
| 5631 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5632 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5633 | |
| 5634 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5635 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5636 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5637 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5638 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5639 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5640 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5641 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5642 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5643 | |
| 5644 | { } |
| 5645 | }; |
| 5646 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5647 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 5648 | * (adapted from Acer init verbs). |
| 5649 | */ |
| 5650 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 5651 | /* GPIO 0 enables the output jack. |
| 5652 | * Turn this on and rely on the standard mute |
| 5653 | * methods whenever the user wants to turn these outputs off. |
| 5654 | */ |
| 5655 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5656 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5657 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5658 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 5659 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5660 | /* Ensure all other unused pins are disabled and muted. */ |
| 5661 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5662 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5663 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5664 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5665 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5666 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5667 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5668 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5669 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5670 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5671 | /* Disable digital (SPDIF) pins */ |
| 5672 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5673 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5674 | |
| 5675 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 5676 | * bus when acting as outputs. |
| 5677 | */ |
| 5678 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5679 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5680 | |
| 5681 | /* Start with output sum widgets muted and their output gains at min */ |
| 5682 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5683 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5684 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5685 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5686 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5687 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5688 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5689 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5690 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5691 | |
| 5692 | /* Unmute Line-out pin widget amp left and right |
| 5693 | * (no equiv mixer ctrl) |
| 5694 | */ |
| 5695 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5696 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5697 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5698 | * will take care of enabling the pin's input/output buffers as needed. |
| 5699 | * Therefore there's no need to enable the input buffer at this |
| 5700 | * stage. |
| 5701 | */ |
| 5702 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5703 | |
| 5704 | /* Mute capture amp left and right */ |
| 5705 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5706 | /* Set ADC connection select to match default mixer setting - mic |
| 5707 | * (on mic1 pin) |
| 5708 | */ |
| 5709 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5710 | |
| 5711 | /* Do similar with the second ADC: mute capture input amp and |
| 5712 | * set ADC connection to mic to match ALSA's default state. |
| 5713 | */ |
| 5714 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5715 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5716 | |
| 5717 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5718 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5719 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5720 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5721 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5722 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5723 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5724 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5725 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5726 | |
| 5727 | { } |
| 5728 | }; |
| 5729 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5730 | static struct hda_verb alc260_will_verbs[] = { |
| 5731 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5732 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5733 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5734 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5735 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5736 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 5737 | {} |
| 5738 | }; |
| 5739 | |
| 5740 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 5741 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5742 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5743 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 5744 | |
| 5745 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5746 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5747 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5748 | |
| 5749 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5750 | {} |
| 5751 | }; |
| 5752 | |
| 5753 | /* toggle speaker-output according to the hp-jack state */ |
| 5754 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 5755 | { |
| 5756 | unsigned int present; |
| 5757 | |
| 5758 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5759 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5760 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5761 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5762 | AC_VERB_SET_GPIO_DATA, 1); |
| 5763 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5764 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5765 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5766 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5767 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5768 | AC_VERB_SET_GPIO_DATA, 0); |
| 5769 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5770 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5771 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5772 | } |
| 5773 | } |
| 5774 | |
| 5775 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 5776 | unsigned int res) |
| 5777 | { |
| 5778 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5779 | alc260_replacer_672v_automute(codec); |
| 5780 | } |
| 5781 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5782 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 5783 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5784 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5785 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5786 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5787 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5788 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5789 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5790 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5791 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5792 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5793 | {} |
| 5794 | }; |
| 5795 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5796 | /* Test configuration for debugging, modelled after the ALC880 test |
| 5797 | * configuration. |
| 5798 | */ |
| 5799 | #ifdef CONFIG_SND_DEBUG |
| 5800 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 5801 | 0x02, |
| 5802 | }; |
| 5803 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 5804 | 0x04, 0x05, |
| 5805 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5806 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5807 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5808 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5809 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5810 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 5811 | { |
| 5812 | .num_items = 7, |
| 5813 | .items = { |
| 5814 | { "MIC1 pin", 0x0 }, |
| 5815 | { "MIC2 pin", 0x1 }, |
| 5816 | { "LINE1 pin", 0x2 }, |
| 5817 | { "LINE2 pin", 0x3 }, |
| 5818 | { "CD pin", 0x4 }, |
| 5819 | { "LINE-OUT pin", 0x5 }, |
| 5820 | { "HP-OUT pin", 0x6 }, |
| 5821 | }, |
| 5822 | }, |
| 5823 | { |
| 5824 | .num_items = 8, |
| 5825 | .items = { |
| 5826 | { "MIC1 pin", 0x0 }, |
| 5827 | { "MIC2 pin", 0x1 }, |
| 5828 | { "LINE1 pin", 0x2 }, |
| 5829 | { "LINE2 pin", 0x3 }, |
| 5830 | { "CD pin", 0x4 }, |
| 5831 | { "Mixer", 0x5 }, |
| 5832 | { "LINE-OUT pin", 0x6 }, |
| 5833 | { "HP-OUT pin", 0x7 }, |
| 5834 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5835 | }, |
| 5836 | }; |
| 5837 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 5838 | /* Output driver widgets */ |
| 5839 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5840 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5841 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5842 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 5843 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5844 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 5845 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5846 | /* Modes for retasking pin widgets |
| 5847 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 5848 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 5849 | * mention this restriction. At this stage it's not clear whether |
| 5850 | * this behaviour is intentional or is a hardware bug in chip |
| 5851 | * revisions available at least up until early 2006. Therefore for |
| 5852 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 5853 | * choices, but if it turns out that the lack of mic bias for these |
| 5854 | * NIDs is intentional we could change their modes from |
| 5855 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5856 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5857 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 5858 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5859 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 5860 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5861 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 5862 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 5863 | |
| 5864 | /* Loopback mixer controls */ |
| 5865 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 5866 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 5867 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5868 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 5869 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5870 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5871 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 5872 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 5873 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5874 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5875 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5876 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5877 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 5878 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5879 | |
| 5880 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 5881 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 5882 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 5883 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 5884 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 5885 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5886 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 5887 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5888 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5889 | */ |
| 5890 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 5891 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 5892 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 5893 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 5894 | * this output to turn on an external amplifier. |
| 5895 | */ |
| 5896 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 5897 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 5898 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5899 | { } /* end */ |
| 5900 | }; |
| 5901 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5902 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 5903 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 5904 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5905 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 5906 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5907 | /* Enable retasking pins as output, initially without power amp */ |
| 5908 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5909 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5910 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5911 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5912 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5913 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5914 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5915 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 5916 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 5917 | * payload also sets the generation to 0, output to be in "consumer" |
| 5918 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 5919 | * control. |
| 5920 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5921 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5922 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5923 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5924 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5925 | * OUT1 sum bus when acting as an output. |
| 5926 | */ |
| 5927 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5928 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5929 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5930 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5931 | |
| 5932 | /* Start with output sum widgets muted and their output gains at min */ |
| 5933 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5934 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5935 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5936 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5937 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5938 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5939 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5940 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5941 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5942 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5943 | /* Unmute retasking pin widget output buffers since the default |
| 5944 | * state appears to be output. As the pin mode is changed by the |
| 5945 | * user the pin mode control will take care of enabling the pin's |
| 5946 | * input/output buffers as needed. |
| 5947 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5948 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5949 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5950 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5951 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5952 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5953 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5954 | /* Also unmute the mono-out pin widget */ |
| 5955 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5956 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5957 | /* Mute capture amp left and right */ |
| 5958 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5959 | /* Set ADC connection select to match default mixer setting (mic1 |
| 5960 | * pin) |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5961 | */ |
| 5962 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5963 | |
| 5964 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5965 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5966 | */ |
| 5967 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5968 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5969 | |
| 5970 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5971 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5972 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5973 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5974 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5975 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5976 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5977 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5978 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5979 | |
| 5980 | { } |
| 5981 | }; |
| 5982 | #endif |
| 5983 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5984 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 5985 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5986 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5987 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 5988 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 5989 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5990 | /* |
| 5991 | * for BIOS auto-configuration |
| 5992 | */ |
| 5993 | |
| 5994 | 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] | 5995 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5996 | { |
| 5997 | hda_nid_t nid_vol; |
| 5998 | unsigned long vol_val, sw_val; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5999 | int err; |
| 6000 | |
| 6001 | if (nid >= 0x0f && nid < 0x11) { |
| 6002 | nid_vol = nid - 0x7; |
| 6003 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6004 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6005 | } else if (nid == 0x11) { |
| 6006 | nid_vol = nid - 0x7; |
| 6007 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 6008 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 6009 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 6010 | nid_vol = 0x08; |
| 6011 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6012 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6013 | } else |
| 6014 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6015 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6016 | if (!(*vol_bits & (1 << nid_vol))) { |
| 6017 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6018 | 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] | 6019 | if (err < 0) |
| 6020 | return err; |
| 6021 | *vol_bits |= (1 << nid_vol); |
| 6022 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6023 | 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] | 6024 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6025 | return err; |
| 6026 | return 1; |
| 6027 | } |
| 6028 | |
| 6029 | /* add playback controls from the parsed DAC table */ |
| 6030 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 6031 | const struct auto_pin_cfg *cfg) |
| 6032 | { |
| 6033 | hda_nid_t nid; |
| 6034 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6035 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6036 | |
| 6037 | spec->multiout.num_dacs = 1; |
| 6038 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6039 | spec->multiout.dac_nids[0] = 0x02; |
| 6040 | |
| 6041 | nid = cfg->line_out_pins[0]; |
| 6042 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 6043 | const char *pfx; |
| 6044 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 6045 | pfx = "Master"; |
| 6046 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 6047 | pfx = "Speaker"; |
| 6048 | else |
| 6049 | pfx = "Front"; |
| 6050 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6051 | if (err < 0) |
| 6052 | return err; |
| 6053 | } |
| 6054 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6055 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6056 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6057 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6058 | if (err < 0) |
| 6059 | return err; |
| 6060 | } |
| 6061 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6062 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6063 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6064 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 6065 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6066 | if (err < 0) |
| 6067 | return err; |
| 6068 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6069 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6070 | } |
| 6071 | |
| 6072 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6073 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6074 | const struct auto_pin_cfg *cfg) |
| 6075 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6076 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6077 | } |
| 6078 | |
| 6079 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6080 | hda_nid_t nid, int pin_type, |
| 6081 | int sel_idx) |
| 6082 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6083 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6084 | /* need the manual connection? */ |
| 6085 | if (nid >= 0x12) { |
| 6086 | int idx = nid - 0x12; |
| 6087 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 6088 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6089 | } |
| 6090 | } |
| 6091 | |
| 6092 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 6093 | { |
| 6094 | struct alc_spec *spec = codec->spec; |
| 6095 | hda_nid_t nid; |
| 6096 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6097 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6098 | if (nid) { |
| 6099 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 6100 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 6101 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6102 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6103 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6104 | if (nid) |
| 6105 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 6106 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6107 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6108 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6109 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6110 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6111 | |
| 6112 | #define ALC260_PIN_CD_NID 0x16 |
| 6113 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 6114 | { |
| 6115 | struct alc_spec *spec = codec->spec; |
| 6116 | int i; |
| 6117 | |
| 6118 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6119 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 6120 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 6121 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 6122 | if (nid != ALC260_PIN_CD_NID && |
| 6123 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6124 | snd_hda_codec_write(codec, nid, 0, |
| 6125 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6126 | AMP_OUT_MUTE); |
| 6127 | } |
| 6128 | } |
| 6129 | } |
| 6130 | |
| 6131 | /* |
| 6132 | * generic initialization of ADC, input mixers and output mixers |
| 6133 | */ |
| 6134 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 6135 | /* |
| 6136 | * Unmute ADC0-1 and set the default input to mic-in |
| 6137 | */ |
| 6138 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6139 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6140 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6141 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6142 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6143 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6144 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6145 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6146 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6147 | */ |
| 6148 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6149 | /* mute analog inputs */ |
| 6150 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6151 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6152 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6153 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6154 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6155 | |
| 6156 | /* |
| 6157 | * Set up output mixers (0x08 - 0x0a) |
| 6158 | */ |
| 6159 | /* set vol=0 to output mixers */ |
| 6160 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6161 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6162 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6163 | /* set up input amps for analog loopback */ |
| 6164 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6165 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6166 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6167 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6168 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6169 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6170 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6171 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6172 | { } |
| 6173 | }; |
| 6174 | |
| 6175 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 6176 | { |
| 6177 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6178 | int err; |
| 6179 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 6180 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6181 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 6182 | alc260_ignore); |
| 6183 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6184 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6185 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 6186 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6187 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6188 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6189 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6190 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6191 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6192 | return err; |
| 6193 | |
| 6194 | spec->multiout.max_channels = 2; |
| 6195 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 6196 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6197 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6198 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6199 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6200 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6201 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6202 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6203 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 6204 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6205 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 6206 | alc_ssid_check(codec, 0x10, 0x15, 0x0f); |
| 6207 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6208 | return 1; |
| 6209 | } |
| 6210 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6211 | /* additional initialization for auto-configuration model */ |
| 6212 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6213 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6214 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6215 | alc260_auto_init_multi_out(codec); |
| 6216 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6217 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6218 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6219 | } |
| 6220 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6221 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6222 | static struct hda_amp_list alc260_loopbacks[] = { |
| 6223 | { 0x07, HDA_INPUT, 0 }, |
| 6224 | { 0x07, HDA_INPUT, 1 }, |
| 6225 | { 0x07, HDA_INPUT, 2 }, |
| 6226 | { 0x07, HDA_INPUT, 3 }, |
| 6227 | { 0x07, HDA_INPUT, 4 }, |
| 6228 | { } /* end */ |
| 6229 | }; |
| 6230 | #endif |
| 6231 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6232 | /* |
| 6233 | * ALC260 configurations |
| 6234 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6235 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 6236 | [ALC260_BASIC] = "basic", |
| 6237 | [ALC260_HP] = "hp", |
| 6238 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 6239 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6240 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 6241 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6242 | [ALC260_WILL] = "will", |
| 6243 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6244 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6245 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6246 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6247 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6248 | [ALC260_AUTO] = "auto", |
| 6249 | }; |
| 6250 | |
| 6251 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6252 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 6253 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6254 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6255 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 6256 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 6257 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6258 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 6259 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6260 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6261 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 6262 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 6263 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 6264 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 6265 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 6266 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 6267 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 6268 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 6269 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6270 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6271 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6272 | {} |
| 6273 | }; |
| 6274 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6275 | static struct alc_config_preset alc260_presets[] = { |
| 6276 | [ALC260_BASIC] = { |
| 6277 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6278 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6279 | .init_verbs = { alc260_init_verbs }, |
| 6280 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6281 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6282 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6283 | .adc_nids = alc260_adc_nids, |
| 6284 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6285 | .channel_mode = alc260_modes, |
| 6286 | .input_mux = &alc260_capture_source, |
| 6287 | }, |
| 6288 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6289 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6290 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6291 | .init_verbs = { alc260_init_verbs, |
| 6292 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6293 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6294 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6295 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6296 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6297 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6298 | .channel_mode = alc260_modes, |
| 6299 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6300 | .unsol_event = alc260_hp_unsol_event, |
| 6301 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6302 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6303 | [ALC260_HP_DC7600] = { |
| 6304 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6305 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6306 | .init_verbs = { alc260_init_verbs, |
| 6307 | alc260_hp_dc7600_verbs }, |
| 6308 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6309 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6310 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6311 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6312 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6313 | .channel_mode = alc260_modes, |
| 6314 | .input_mux = &alc260_capture_source, |
| 6315 | .unsol_event = alc260_hp_3012_unsol_event, |
| 6316 | .init_hook = alc260_hp_3012_automute, |
| 6317 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6318 | [ALC260_HP_3013] = { |
| 6319 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6320 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6321 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 6322 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6323 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6324 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6325 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6326 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6327 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6328 | .channel_mode = alc260_modes, |
| 6329 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6330 | .unsol_event = alc260_hp_3013_unsol_event, |
| 6331 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6332 | }, |
| 6333 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6334 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6335 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 6336 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6337 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6338 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6339 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6340 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6341 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6342 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 6343 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6344 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6345 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6346 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6347 | .init_verbs = { alc260_acer_init_verbs }, |
| 6348 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6349 | .dac_nids = alc260_dac_nids, |
| 6350 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6351 | .adc_nids = alc260_dual_adc_nids, |
| 6352 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6353 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6354 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 6355 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6356 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6357 | [ALC260_FAVORIT100] = { |
| 6358 | .mixers = { alc260_favorit100_mixer }, |
| 6359 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 6360 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6361 | .dac_nids = alc260_dac_nids, |
| 6362 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6363 | .adc_nids = alc260_dual_adc_nids, |
| 6364 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6365 | .channel_mode = alc260_modes, |
| 6366 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 6367 | .input_mux = alc260_favorit100_capture_sources, |
| 6368 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6369 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6370 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6371 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6372 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6373 | .dac_nids = alc260_dac_nids, |
| 6374 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6375 | .adc_nids = alc260_adc_nids, |
| 6376 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6377 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6378 | .channel_mode = alc260_modes, |
| 6379 | .input_mux = &alc260_capture_source, |
| 6380 | }, |
| 6381 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6382 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6383 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6384 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6385 | .dac_nids = alc260_dac_nids, |
| 6386 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6387 | .adc_nids = alc260_adc_nids, |
| 6388 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6389 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6390 | .channel_mode = alc260_modes, |
| 6391 | .input_mux = &alc260_capture_source, |
| 6392 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6393 | .init_hook = alc260_replacer_672v_automute, |
| 6394 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6395 | #ifdef CONFIG_SND_DEBUG |
| 6396 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6397 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6398 | .init_verbs = { alc260_test_init_verbs }, |
| 6399 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6400 | .dac_nids = alc260_test_dac_nids, |
| 6401 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6402 | .adc_nids = alc260_test_adc_nids, |
| 6403 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6404 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6405 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6406 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6407 | }, |
| 6408 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6409 | }; |
| 6410 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6411 | static int patch_alc260(struct hda_codec *codec) |
| 6412 | { |
| 6413 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6414 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6415 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6416 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6417 | if (spec == NULL) |
| 6418 | return -ENOMEM; |
| 6419 | |
| 6420 | codec->spec = spec; |
| 6421 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6422 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 6423 | alc260_models, |
| 6424 | alc260_cfg_tbl); |
| 6425 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 6426 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 6427 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6428 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6429 | } |
| 6430 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6431 | if (board_config == ALC260_AUTO) { |
| 6432 | /* automatic parse from the BIOS config */ |
| 6433 | err = alc260_parse_auto_config(codec); |
| 6434 | if (err < 0) { |
| 6435 | alc_free(codec); |
| 6436 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6437 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6438 | printk(KERN_INFO |
| 6439 | "hda_codec: Cannot set up configuration " |
| 6440 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6441 | board_config = ALC260_BASIC; |
| 6442 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6443 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6444 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6445 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6446 | if (err < 0) { |
| 6447 | alc_free(codec); |
| 6448 | return err; |
| 6449 | } |
| 6450 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6451 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 6452 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6453 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6454 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6455 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6456 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6457 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6458 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6459 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6460 | if (!spec->adc_nids && spec->input_mux) { |
| 6461 | /* check whether NID 0x04 is valid */ |
| 6462 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 6463 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6464 | /* get type */ |
| 6465 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6466 | spec->adc_nids = alc260_adc_nids_alt; |
| 6467 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6468 | } else { |
| 6469 | spec->adc_nids = alc260_adc_nids; |
| 6470 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6471 | } |
| 6472 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 6473 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6474 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6475 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6476 | spec->vmaster_nid = 0x08; |
| 6477 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6478 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6479 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6480 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6481 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6482 | if (!spec->loopback.amplist) |
| 6483 | spec->loopback.amplist = alc260_loopbacks; |
| 6484 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 6485 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6486 | |
| 6487 | return 0; |
| 6488 | } |
| 6489 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6490 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6491 | /* |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6492 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6493 | * |
| 6494 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6495 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6496 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6497 | * 6-channel independent captures. |
| 6498 | * |
| 6499 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6500 | * driver yet). |
| 6501 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6502 | #define ALC882_DIGOUT_NID 0x06 |
| 6503 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6504 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 6505 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 6506 | #define ALC1200_DIGOUT_NID 0x10 |
| 6507 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6508 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6509 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6510 | { 8, NULL } |
| 6511 | }; |
| 6512 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6513 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6514 | static hda_nid_t alc882_dac_nids[4] = { |
| 6515 | /* front, rear, clfe, rear_surr */ |
| 6516 | 0x02, 0x03, 0x04, 0x05 |
| 6517 | }; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6518 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6519 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6520 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6521 | #define alc882_adc_nids alc880_adc_nids |
| 6522 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6523 | #define alc883_adc_nids alc882_adc_nids_alt |
| 6524 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 6525 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 6526 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6527 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6528 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 6529 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6530 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 6531 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 6532 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6533 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6534 | /* input MUX */ |
| 6535 | /* FIXME: should be a matrix-type input source selection */ |
| 6536 | |
| 6537 | static struct hda_input_mux alc882_capture_source = { |
| 6538 | .num_items = 4, |
| 6539 | .items = { |
| 6540 | { "Mic", 0x0 }, |
| 6541 | { "Front Mic", 0x1 }, |
| 6542 | { "Line", 0x2 }, |
| 6543 | { "CD", 0x4 }, |
| 6544 | }, |
| 6545 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6546 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6547 | #define alc883_capture_source alc882_capture_source |
| 6548 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6549 | static struct hda_input_mux alc889_capture_source = { |
| 6550 | .num_items = 3, |
| 6551 | .items = { |
| 6552 | { "Front Mic", 0x0 }, |
| 6553 | { "Mic", 0x3 }, |
| 6554 | { "Line", 0x2 }, |
| 6555 | }, |
| 6556 | }; |
| 6557 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6558 | static struct hda_input_mux mb5_capture_source = { |
| 6559 | .num_items = 3, |
| 6560 | .items = { |
| 6561 | { "Mic", 0x1 }, |
| 6562 | { "Line", 0x2 }, |
| 6563 | { "CD", 0x4 }, |
| 6564 | }, |
| 6565 | }; |
| 6566 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6567 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 6568 | .num_items = 4, |
| 6569 | .items = { |
| 6570 | { "Mic", 0x1 }, |
| 6571 | { "Front Mic", 0x0 }, |
| 6572 | { "Line", 0x2 }, |
| 6573 | { "CD", 0x4 }, |
| 6574 | }, |
| 6575 | }; |
| 6576 | |
| 6577 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6578 | .num_items = 2, |
| 6579 | .items = { |
| 6580 | { "Mic", 0x1 }, |
| 6581 | { "Line", 0x2 }, |
| 6582 | }, |
| 6583 | }; |
| 6584 | |
| 6585 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6586 | .num_items = 4, |
| 6587 | .items = { |
| 6588 | { "Mic", 0x0 }, |
| 6589 | { "iMic", 0x1 }, |
| 6590 | { "Line", 0x2 }, |
| 6591 | { "CD", 0x4 }, |
| 6592 | }, |
| 6593 | }; |
| 6594 | |
| 6595 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6596 | .num_items = 2, |
| 6597 | .items = { |
| 6598 | { "Mic", 0x0 }, |
| 6599 | { "Int Mic", 0x1 }, |
| 6600 | }, |
| 6601 | }; |
| 6602 | |
| 6603 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 6604 | .num_items = 3, |
| 6605 | .items = { |
| 6606 | { "Mic", 0x0 }, |
| 6607 | { "Front Mic", 0x1 }, |
| 6608 | { "Line", 0x4 }, |
| 6609 | }, |
| 6610 | }; |
| 6611 | |
| 6612 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 6613 | .num_items = 2, |
| 6614 | .items = { |
| 6615 | { "Mic", 0x0 }, |
| 6616 | { "Line", 0x2 }, |
| 6617 | }, |
| 6618 | }; |
| 6619 | |
| 6620 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 6621 | .num_items = 2, |
| 6622 | .items = { |
| 6623 | { "Mic", 0x0 }, |
| 6624 | /* Front Mic (0x01) unused */ |
| 6625 | { "Line", 0x2 }, |
| 6626 | /* Line 2 (0x03) unused */ |
| 6627 | /* CD (0x04) unsused? */ |
| 6628 | }, |
| 6629 | }; |
| 6630 | |
| 6631 | /* |
| 6632 | * 2ch mode |
| 6633 | */ |
| 6634 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6635 | { 2, NULL } |
| 6636 | }; |
| 6637 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6638 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6639 | * 2ch mode |
| 6640 | */ |
| 6641 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 6642 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6643 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6644 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6645 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6646 | { } /* end */ |
| 6647 | }; |
| 6648 | |
| 6649 | /* |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6650 | * 4ch mode |
| 6651 | */ |
| 6652 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 6653 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6654 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6655 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6656 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6657 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6658 | { } /* end */ |
| 6659 | }; |
| 6660 | |
| 6661 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6662 | * 6ch mode |
| 6663 | */ |
| 6664 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 6665 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6666 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6667 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6668 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6669 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6670 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6671 | { } /* end */ |
| 6672 | }; |
| 6673 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6674 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6675 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6676 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6677 | { 6, alc882_3ST_ch6_init }, |
| 6678 | }; |
| 6679 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6680 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 6681 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6682 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 6683 | * 2ch mode |
| 6684 | */ |
| 6685 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 6686 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 6687 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6688 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6689 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6690 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6691 | { } /* end */ |
| 6692 | }; |
| 6693 | |
| 6694 | /* |
| 6695 | * 4ch mode |
| 6696 | */ |
| 6697 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 6698 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6699 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6700 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6701 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6702 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6703 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6704 | { } /* end */ |
| 6705 | }; |
| 6706 | |
| 6707 | /* |
| 6708 | * 6ch mode |
| 6709 | */ |
| 6710 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 6711 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6712 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6713 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6714 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6715 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6716 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6717 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6718 | { } /* end */ |
| 6719 | }; |
| 6720 | |
| 6721 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 6722 | { 2, alc883_3ST_ch2_clevo_init }, |
| 6723 | { 4, alc883_3ST_ch4_clevo_init }, |
| 6724 | { 6, alc883_3ST_ch6_clevo_init }, |
| 6725 | }; |
| 6726 | |
| 6727 | |
| 6728 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6729 | * 6ch mode |
| 6730 | */ |
| 6731 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 6732 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6733 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6734 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6735 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6736 | { } /* end */ |
| 6737 | }; |
| 6738 | |
| 6739 | /* |
| 6740 | * 8ch mode |
| 6741 | */ |
| 6742 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 6743 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6744 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6745 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6746 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6747 | { } /* end */ |
| 6748 | }; |
| 6749 | |
| 6750 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 6751 | { 6, alc882_sixstack_ch6_init }, |
| 6752 | { 8, alc882_sixstack_ch8_init }, |
| 6753 | }; |
| 6754 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6755 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 6756 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6757 | */ |
| 6758 | |
| 6759 | /* |
| 6760 | * 2ch mode |
| 6761 | */ |
| 6762 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 6763 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6764 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6765 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6766 | { } /* end */ |
| 6767 | }; |
| 6768 | |
| 6769 | /* |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 6770 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6771 | */ |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 6772 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6773 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6774 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6775 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6776 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6777 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6778 | { } /* end */ |
| 6779 | }; |
| 6780 | |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 6781 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6782 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 6783 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6784 | }; |
| 6785 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6786 | /* |
| 6787 | * 2ch |
| 6788 | * Speakers/Woofer/HP = Front |
| 6789 | * LineIn = Input |
| 6790 | */ |
| 6791 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 6792 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6793 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6794 | { } /* end */ |
| 6795 | }; |
| 6796 | |
| 6797 | /* |
| 6798 | * 6ch mode |
| 6799 | * Speakers/HP = Front |
| 6800 | * Woofer = LFE |
| 6801 | * LineIn = Surround |
| 6802 | */ |
| 6803 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 6804 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6805 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6806 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6807 | { } /* end */ |
| 6808 | }; |
| 6809 | |
| 6810 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 6811 | { 2, alc885_mb5_ch2_init }, |
| 6812 | { 6, alc885_mb5_ch6_init }, |
| 6813 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6814 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6815 | |
| 6816 | /* |
| 6817 | * 2ch mode |
| 6818 | */ |
| 6819 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 6820 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6821 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6822 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6823 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6824 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6825 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6826 | { } /* end */ |
| 6827 | }; |
| 6828 | |
| 6829 | /* |
| 6830 | * 4ch mode |
| 6831 | */ |
| 6832 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 6833 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6834 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6835 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6836 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6837 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6838 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6839 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6840 | { } /* end */ |
| 6841 | }; |
| 6842 | |
| 6843 | /* |
| 6844 | * 6ch mode |
| 6845 | */ |
| 6846 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 6847 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6848 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6849 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6850 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6851 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6852 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6853 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6854 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6855 | { } /* end */ |
| 6856 | }; |
| 6857 | |
| 6858 | /* |
| 6859 | * 8ch mode |
| 6860 | */ |
| 6861 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 6862 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6863 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6864 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6865 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6866 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6867 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6868 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6869 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6870 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6871 | { } /* end */ |
| 6872 | }; |
| 6873 | |
| 6874 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 6875 | { 2, alc883_4ST_ch2_init }, |
| 6876 | { 4, alc883_4ST_ch4_init }, |
| 6877 | { 6, alc883_4ST_ch6_init }, |
| 6878 | { 8, alc883_4ST_ch8_init }, |
| 6879 | }; |
| 6880 | |
| 6881 | |
| 6882 | /* |
| 6883 | * 2ch mode |
| 6884 | */ |
| 6885 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 6886 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6887 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6888 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6889 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6890 | { } /* end */ |
| 6891 | }; |
| 6892 | |
| 6893 | /* |
| 6894 | * 4ch mode |
| 6895 | */ |
| 6896 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 6897 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6898 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6899 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6900 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6901 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6902 | { } /* end */ |
| 6903 | }; |
| 6904 | |
| 6905 | /* |
| 6906 | * 6ch mode |
| 6907 | */ |
| 6908 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 6909 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6910 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6911 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6912 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6913 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6914 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6915 | { } /* end */ |
| 6916 | }; |
| 6917 | |
| 6918 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 6919 | { 2, alc883_3ST_ch2_intel_init }, |
| 6920 | { 4, alc883_3ST_ch4_intel_init }, |
| 6921 | { 6, alc883_3ST_ch6_intel_init }, |
| 6922 | }; |
| 6923 | |
| 6924 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6925 | * 2ch mode |
| 6926 | */ |
| 6927 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 6928 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6929 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6930 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6931 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6932 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6933 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6934 | { } /* end */ |
| 6935 | }; |
| 6936 | |
| 6937 | /* |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6938 | * 6ch mode |
| 6939 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6940 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6941 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6942 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6943 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6944 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6945 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6946 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6947 | { } /* end */ |
| 6948 | }; |
| 6949 | |
| 6950 | /* |
| 6951 | * 8ch mode |
| 6952 | */ |
| 6953 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6954 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6955 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6956 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6957 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6958 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6959 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6960 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6961 | { } /* end */ |
| 6962 | }; |
| 6963 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6964 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 6965 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6966 | { 6, alc889_ch6_intel_init }, |
| 6967 | { 8, alc889_ch8_intel_init }, |
| 6968 | }; |
| 6969 | |
| 6970 | /* |
| 6971 | * 6ch mode |
| 6972 | */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6973 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6974 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6975 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6976 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6977 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6978 | { } /* end */ |
| 6979 | }; |
| 6980 | |
| 6981 | /* |
| 6982 | * 8ch mode |
| 6983 | */ |
| 6984 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6985 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6986 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6987 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6988 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6989 | { } /* end */ |
| 6990 | }; |
| 6991 | |
| 6992 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6993 | { 6, alc883_sixstack_ch6_init }, |
| 6994 | { 8, alc883_sixstack_ch8_init }, |
| 6995 | }; |
| 6996 | |
| 6997 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6998 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6999 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7000 | */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 7001 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7002 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7003 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7004 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7005 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7006 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7007 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7008 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7009 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7010 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7011 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7012 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7013 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7014 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7015 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7016 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7017 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7018 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7019 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7020 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7021 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7022 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7023 | { } /* end */ |
| 7024 | }; |
| 7025 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7026 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7027 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7028 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7029 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7030 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7031 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7032 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7033 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7034 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7035 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7036 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7037 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7038 | { } /* end */ |
| 7039 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7040 | |
| 7041 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7042 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7043 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7044 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7045 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7046 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7047 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7048 | HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7049 | HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7050 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7051 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7052 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7053 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7054 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7055 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 7056 | { } /* end */ |
| 7057 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7058 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7059 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
| 7060 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7061 | HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7062 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 7063 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7064 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7065 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7066 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7067 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 7068 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7069 | { } /* end */ |
| 7070 | }; |
| 7071 | |
| 7072 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7073 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 7074 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7075 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7076 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7077 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7078 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7079 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7080 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7081 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7082 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7083 | { } /* end */ |
| 7084 | }; |
| 7085 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7086 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 7087 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7088 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7089 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7090 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7091 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7092 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7093 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7094 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7095 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7096 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7097 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7098 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7099 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7100 | { } /* end */ |
| 7101 | }; |
| 7102 | |
| 7103 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 7104 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 7105 | */ |
| 7106 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 7107 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7108 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7109 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7110 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 7111 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7112 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7113 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7114 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7115 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 7116 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 7117 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7118 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7119 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7120 | { } /* end */ |
| 7121 | }; |
| 7122 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7123 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 7124 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7125 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7126 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7127 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7128 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7129 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7130 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7131 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7132 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7133 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7134 | { } /* end */ |
| 7135 | }; |
| 7136 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7137 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 7138 | { |
| 7139 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7140 | .name = "Channel Mode", |
| 7141 | .info = alc_ch_mode_info, |
| 7142 | .get = alc_ch_mode_get, |
| 7143 | .put = alc_ch_mode_put, |
| 7144 | }, |
| 7145 | { } /* end */ |
| 7146 | }; |
| 7147 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7148 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7149 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7150 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7151 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7152 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7153 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7154 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7155 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7156 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7157 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7158 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7159 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7160 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7161 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7162 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7163 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7164 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7165 | |
Takashi Iwai | cb63812 | 2009-07-03 10:56:10 +0200 | [diff] [blame] | 7166 | /* mute analog input loopbacks */ |
| 7167 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7168 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7169 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7170 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7171 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7172 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7173 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7174 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7175 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7176 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7177 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7178 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7179 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7180 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7181 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7182 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7183 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7184 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7185 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7186 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7187 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7188 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7189 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7190 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7191 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7192 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7193 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7194 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7195 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7196 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7197 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7198 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7199 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7200 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7201 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7202 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7203 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7204 | |
| 7205 | /* FIXME: use matrix-type input source selection */ |
| 7206 | /* 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] | 7207 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7208 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7209 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7210 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7211 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7212 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7213 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7214 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7215 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7216 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7217 | /* ADC2: mute amp left and right */ |
| 7218 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7219 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7220 | /* ADC3: mute amp left and right */ |
| 7221 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7222 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7223 | |
| 7224 | { } |
| 7225 | }; |
| 7226 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7227 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 7228 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7229 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7230 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7231 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7232 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7233 | /* ADC1: mute amp left and right */ |
| 7234 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7235 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7236 | { } |
| 7237 | }; |
| 7238 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7239 | static struct hda_verb alc882_eapd_verbs[] = { |
| 7240 | /* change to EAPD mode */ |
| 7241 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7242 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7243 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7244 | }; |
| 7245 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7246 | static struct hda_verb alc889_eapd_verbs[] = { |
| 7247 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7248 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7249 | { } |
| 7250 | }; |
| 7251 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7252 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 7253 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7254 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7255 | {} |
| 7256 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7257 | |
| 7258 | static struct hda_verb alc885_init_verbs[] = { |
| 7259 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7260 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7261 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7262 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7263 | /* Rear mixer */ |
| 7264 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7265 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7266 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7267 | /* CLFE mixer */ |
| 7268 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7269 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7270 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7271 | /* Side mixer */ |
| 7272 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7273 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7274 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7275 | |
| 7276 | /* mute analog input loopbacks */ |
| 7277 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7278 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7279 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7280 | |
| 7281 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7282 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7283 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7284 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7285 | /* Front Pin: output 0 (0x0c) */ |
| 7286 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7287 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7288 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7289 | /* Rear Pin: output 1 (0x0d) */ |
| 7290 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7291 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7292 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7293 | /* CLFE Pin: output 2 (0x0e) */ |
| 7294 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7295 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7296 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7297 | /* Side Pin: output 3 (0x0f) */ |
| 7298 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7299 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7300 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7301 | /* Mic (rear) pin: input vref at 80% */ |
| 7302 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7303 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7304 | /* Front Mic pin: input vref at 80% */ |
| 7305 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7306 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7307 | /* Line In pin: input */ |
| 7308 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7309 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7310 | |
| 7311 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 7312 | /* Input mixer1 */ |
| 7313 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7314 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7315 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7316 | /* Input mixer2 */ |
| 7317 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7318 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7319 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7320 | /* Input mixer3 */ |
| 7321 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7322 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7323 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7324 | /* ADC2: mute amp left and right */ |
| 7325 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7326 | /* ADC3: mute amp left and right */ |
| 7327 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7328 | |
| 7329 | { } |
| 7330 | }; |
| 7331 | |
| 7332 | static struct hda_verb alc885_init_input_verbs[] = { |
| 7333 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7334 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7335 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7336 | { } |
| 7337 | }; |
| 7338 | |
| 7339 | |
| 7340 | /* Unmute Selector 24h and set the default input to front mic */ |
| 7341 | static struct hda_verb alc889_init_input_verbs[] = { |
| 7342 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7343 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7344 | { } |
| 7345 | }; |
| 7346 | |
| 7347 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7348 | #define alc883_init_verbs alc882_base_init_verbs |
| 7349 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7350 | /* Mac Pro test */ |
| 7351 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 7352 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7353 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7354 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 7355 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7356 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7357 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 7358 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7359 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7360 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7361 | { } /* end */ |
| 7362 | }; |
| 7363 | |
| 7364 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 7365 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7366 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7367 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7368 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7369 | /* Front Pin: output 0 (0x0c) */ |
| 7370 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7371 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7372 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7373 | /* Front Mic pin: input vref at 80% */ |
| 7374 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7375 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7376 | /* Speaker: output */ |
| 7377 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7378 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7379 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 7380 | /* Headphone output (output 0 - 0x0c) */ |
| 7381 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7382 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7383 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7384 | |
| 7385 | /* FIXME: use matrix-type input source selection */ |
| 7386 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7387 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7388 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7389 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7390 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7391 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7392 | /* Input mixer2 */ |
| 7393 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7394 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7395 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7396 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7397 | /* Input mixer3 */ |
| 7398 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7399 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7400 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7401 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7402 | /* ADC1: mute amp left and right */ |
| 7403 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7404 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7405 | /* ADC2: mute amp left and right */ |
| 7406 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7407 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7408 | /* ADC3: mute amp left and right */ |
| 7409 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7410 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7411 | |
| 7412 | { } |
| 7413 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7414 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7415 | /* Macbook 5,1 */ |
| 7416 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7417 | /* DACs */ |
| 7418 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7419 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7420 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7421 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7422 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7423 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7424 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7425 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7426 | /* Surround mixer */ |
| 7427 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7428 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7429 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7430 | /* LFE mixer */ |
| 7431 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7432 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7433 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7434 | /* HP mixer */ |
| 7435 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7436 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7437 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7438 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7439 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7440 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7441 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7442 | /* LFE Pin (0x0e) */ |
| 7443 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7444 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7445 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7446 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7447 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7448 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7449 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7450 | /* Front Mic pin: input vref at 80% */ |
| 7451 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7452 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7453 | /* Line In pin */ |
| 7454 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7455 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7456 | |
| 7457 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7458 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7459 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7460 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7461 | { } |
| 7462 | }; |
| 7463 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7464 | /* Macbook Pro rev3 */ |
| 7465 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 7466 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7467 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7468 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7469 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7470 | /* Rear mixer */ |
| 7471 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7472 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7473 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7474 | /* HP mixer */ |
| 7475 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7476 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7477 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7478 | /* Front Pin: output 0 (0x0c) */ |
| 7479 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7480 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7481 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7482 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7483 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7484 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7485 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7486 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7487 | /* Mic (rear) pin: input vref at 80% */ |
| 7488 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7489 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7490 | /* Front Mic pin: input vref at 80% */ |
| 7491 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7492 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7493 | /* Line In pin: use output 1 when in LineOut mode */ |
| 7494 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7495 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7496 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7497 | |
| 7498 | /* FIXME: use matrix-type input source selection */ |
| 7499 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7500 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7501 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7502 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7503 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7504 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7505 | /* Input mixer2 */ |
| 7506 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7507 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7508 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7509 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7510 | /* Input mixer3 */ |
| 7511 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7512 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7513 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7514 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7515 | /* ADC1: mute amp left and right */ |
| 7516 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7517 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7518 | /* ADC2: mute amp left and right */ |
| 7519 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7520 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7521 | /* ADC3: mute amp left and right */ |
| 7522 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7523 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7524 | |
| 7525 | { } |
| 7526 | }; |
| 7527 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7528 | /* iMac 9,1 */ |
| 7529 | static struct hda_verb alc885_imac91_init_verbs[] = { |
| 7530 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 7531 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7532 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7533 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7534 | /* Rear mixer */ |
| 7535 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7536 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7537 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7538 | /* HP Pin: output 0 (0x0c) */ |
| 7539 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7540 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7541 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7542 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7543 | /* Internal Speakers: output 0 (0x0d) */ |
| 7544 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7545 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7546 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7547 | /* Mic (rear) pin: input vref at 80% */ |
| 7548 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7549 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7550 | /* Front Mic pin: input vref at 80% */ |
| 7551 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7552 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7553 | /* Line In pin: use output 1 when in LineOut mode */ |
| 7554 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7555 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7556 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7557 | |
| 7558 | /* FIXME: use matrix-type input source selection */ |
| 7559 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7560 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7561 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7562 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7563 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7564 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7565 | /* Input mixer2 */ |
| 7566 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7567 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7568 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7569 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7570 | /* Input mixer3 */ |
| 7571 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7572 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7573 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7574 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7575 | /* ADC1: mute amp left and right */ |
| 7576 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7577 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7578 | /* ADC2: mute amp left and right */ |
| 7579 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7580 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7581 | /* ADC3: mute amp left and right */ |
| 7582 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7583 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7584 | |
| 7585 | { } |
| 7586 | }; |
| 7587 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7588 | /* iMac 24 mixer. */ |
| 7589 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 7590 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7591 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 7592 | { } /* end */ |
| 7593 | }; |
| 7594 | |
| 7595 | /* iMac 24 init verbs. */ |
| 7596 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 7597 | /* Internal speakers: output 0 (0x0c) */ |
| 7598 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7599 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7600 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7601 | /* Internal speakers: output 0 (0x0c) */ |
| 7602 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7603 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7604 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7605 | /* Headphone: output 0 (0x0c) */ |
| 7606 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7607 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7608 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7609 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7610 | /* Front Mic: input vref at 80% */ |
| 7611 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7612 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7613 | { } |
| 7614 | }; |
| 7615 | |
| 7616 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7617 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7618 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7619 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7620 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7621 | spec->autocfg.hp_pins[0] = 0x14; |
| 7622 | spec->autocfg.speaker_pins[0] = 0x18; |
| 7623 | spec->autocfg.speaker_pins[1] = 0x1a; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7624 | } |
| 7625 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7626 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7627 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7628 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7629 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7630 | spec->autocfg.hp_pins[0] = 0x15; |
| 7631 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7632 | } |
| 7633 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7634 | static void alc885_imac91_automute(struct hda_codec *codec) |
| 7635 | { |
| 7636 | unsigned int present; |
| 7637 | |
| 7638 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7639 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7640 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7641 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7642 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 7643 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7644 | |
| 7645 | } |
| 7646 | |
| 7647 | static void alc885_imac91_unsol_event(struct hda_codec *codec, |
| 7648 | unsigned int res) |
| 7649 | { |
| 7650 | /* Headphone insertion or removal. */ |
| 7651 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7652 | alc885_imac91_automute(codec); |
| 7653 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7654 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7655 | static struct hda_verb alc882_targa_verbs[] = { |
| 7656 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7657 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7658 | |
| 7659 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7660 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7661 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7662 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7663 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7664 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7665 | |
| 7666 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7667 | { } /* end */ |
| 7668 | }; |
| 7669 | |
| 7670 | /* toggle speaker-output according to the hp-jack state */ |
| 7671 | static void alc882_targa_automute(struct hda_codec *codec) |
| 7672 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7673 | struct alc_spec *spec = codec->spec; |
| 7674 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7675 | 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] | 7676 | spec->jack_present ? 1 : 3); |
| 7677 | } |
| 7678 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7679 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7680 | { |
| 7681 | struct alc_spec *spec = codec->spec; |
| 7682 | |
| 7683 | spec->autocfg.hp_pins[0] = 0x14; |
| 7684 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7685 | } |
| 7686 | |
| 7687 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7688 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7689 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7690 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7691 | } |
| 7692 | |
| 7693 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 7694 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7695 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7696 | |
| 7697 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7698 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7699 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7700 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7701 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7702 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7703 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7704 | |
| 7705 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7706 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7707 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7708 | { } /* end */ |
| 7709 | }; |
| 7710 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7711 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 7712 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7713 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7714 | |
| 7715 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7716 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7717 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7718 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7719 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7720 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7721 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7722 | |
| 7723 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7724 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7725 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7726 | { } /* end */ |
| 7727 | }; |
| 7728 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7729 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 7730 | { |
| 7731 | unsigned int gpiostate, gpiomask, gpiodir; |
| 7732 | |
| 7733 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 7734 | AC_VERB_GET_GPIO_DATA, 0); |
| 7735 | |
| 7736 | if (!muted) |
| 7737 | gpiostate |= (1 << pin); |
| 7738 | else |
| 7739 | gpiostate &= ~(1 << pin); |
| 7740 | |
| 7741 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 7742 | AC_VERB_GET_GPIO_MASK, 0); |
| 7743 | gpiomask |= (1 << pin); |
| 7744 | |
| 7745 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 7746 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 7747 | gpiodir |= (1 << pin); |
| 7748 | |
| 7749 | |
| 7750 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7751 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 7752 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7753 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 7754 | |
| 7755 | msleep(1); |
| 7756 | |
| 7757 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7758 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 7759 | } |
| 7760 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7761 | /* set up GPIO at initialization */ |
| 7762 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 7763 | { |
| 7764 | alc882_gpio_mute(codec, 0, 0); |
| 7765 | alc882_gpio_mute(codec, 1, 0); |
| 7766 | } |
| 7767 | |
| 7768 | /* set up GPIO and update auto-muting at initialization */ |
| 7769 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 7770 | { |
| 7771 | alc885_macpro_init_hook(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7772 | alc_automute_amp(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7773 | } |
| 7774 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7775 | /* |
| 7776 | * generic initialization of ADC, input mixers and output mixers |
| 7777 | */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7778 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7779 | /* |
| 7780 | * Unmute ADC0-2 and set the default input to mic-in |
| 7781 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7782 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7783 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7784 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7785 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7786 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7787 | /* 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] | 7788 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7789 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7790 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7791 | */ |
| 7792 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7793 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7794 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7795 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7796 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7797 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7798 | |
| 7799 | /* |
| 7800 | * Set up output mixers (0x0c - 0x0f) |
| 7801 | */ |
| 7802 | /* set vol=0 to output mixers */ |
| 7803 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7804 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7805 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7806 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7807 | /* set up input amps for analog loopback */ |
| 7808 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7809 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7810 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7811 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7812 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7813 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7814 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7815 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7816 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7817 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7818 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7819 | |
| 7820 | /* FIXME: use matrix-type input source selection */ |
| 7821 | /* 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] | 7822 | /* Input mixer2 */ |
| 7823 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7824 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7825 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7826 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7827 | /* Input mixer3 */ |
| 7828 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7829 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7830 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7831 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7832 | |
| 7833 | { } |
| 7834 | }; |
| 7835 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7836 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 7837 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 7838 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7839 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7840 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7841 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7842 | { } /* end */ |
| 7843 | }; |
| 7844 | |
| 7845 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 7846 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 7847 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7848 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7849 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7850 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7851 | { } /* end */ |
| 7852 | }; |
| 7853 | |
| 7854 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 7855 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 7856 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 7857 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7858 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7859 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7860 | { } /* end */ |
| 7861 | }; |
| 7862 | |
| 7863 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 7864 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 7865 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 7866 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 7867 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7868 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7869 | { } /* end */ |
| 7870 | }; |
| 7871 | |
| 7872 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 7873 | { 2, alc889A_mb31_ch2_init }, |
| 7874 | { 4, alc889A_mb31_ch4_init }, |
| 7875 | { 5, alc889A_mb31_ch5_init }, |
| 7876 | { 6, alc889A_mb31_ch6_init }, |
| 7877 | }; |
| 7878 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7879 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7880 | /* eanable EAPD on medion laptop */ |
| 7881 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7882 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7883 | { } |
| 7884 | }; |
| 7885 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7886 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7887 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7888 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7889 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7890 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7891 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7892 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7893 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7894 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7895 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7896 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7897 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7898 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7899 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7900 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7901 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7902 | { } /* end */ |
| 7903 | }; |
| 7904 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7905 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7906 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7907 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7908 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7909 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7910 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7911 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7912 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7913 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7914 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7915 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7916 | { } /* end */ |
| 7917 | }; |
| 7918 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7919 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7920 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7921 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7922 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7923 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7924 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7925 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7926 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7927 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7928 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7929 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7930 | { } /* end */ |
| 7931 | }; |
| 7932 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7933 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 7934 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7935 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7936 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7937 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7938 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7939 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7940 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7941 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7942 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7943 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7944 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7945 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7946 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7947 | { } /* end */ |
| 7948 | }; |
| 7949 | |
| 7950 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7951 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7952 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7953 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7954 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7955 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7956 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7957 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7958 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7959 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7960 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7961 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7962 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7963 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7964 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7965 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7966 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7967 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7968 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7969 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7970 | { } /* end */ |
| 7971 | }; |
| 7972 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7973 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7974 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7975 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7976 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7977 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7978 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7979 | HDA_OUTPUT), |
| 7980 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7981 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7982 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7983 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7984 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7985 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7986 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7987 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7988 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7989 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7990 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7991 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7992 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7993 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7994 | { } /* end */ |
| 7995 | }; |
| 7996 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7997 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 7998 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7999 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8000 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8001 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8002 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8003 | HDA_OUTPUT), |
| 8004 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8005 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8006 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8007 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8008 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8009 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8010 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8011 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8012 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 8013 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), |
| 8014 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 8015 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8016 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8017 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8018 | { } /* end */ |
| 8019 | }; |
| 8020 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8021 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8022 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8023 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8024 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8025 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8026 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8027 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8028 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8029 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8030 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8031 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8032 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8033 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8034 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8035 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8036 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8037 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8038 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8039 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8040 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8041 | { } /* end */ |
| 8042 | }; |
| 8043 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8044 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8045 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8046 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8047 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8048 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8049 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8050 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8051 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8052 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8053 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8054 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8055 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8056 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8057 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8058 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8059 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8060 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8061 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8062 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8063 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8064 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8065 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8066 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8067 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8068 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8069 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8070 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8071 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8072 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8073 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8074 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8075 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8076 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8077 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8078 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8079 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8080 | |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8081 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
| 8082 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8083 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8084 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8085 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8086 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8087 | { } /* end */ |
| 8088 | }; |
| 8089 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8090 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 8091 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8092 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8093 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8094 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8095 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8096 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8097 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8098 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8099 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8100 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8101 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8102 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 8103 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8104 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8105 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8106 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8107 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8108 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8109 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8110 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8111 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8112 | { } /* end */ |
| 8113 | }; |
| 8114 | |
| 8115 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 8116 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8117 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8118 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8119 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8120 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8121 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8122 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8123 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8124 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8125 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8126 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8127 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8128 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8129 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8130 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8131 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8132 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8133 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8134 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8135 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8136 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8137 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8138 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8139 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8140 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 8141 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8142 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8143 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8144 | HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 8145 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8146 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8147 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8148 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8149 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8150 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8151 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8152 | { } /* end */ |
| 8153 | }; |
| 8154 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8155 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 8156 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8157 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8158 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8159 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 8160 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 8161 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 8162 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 8163 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 8164 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 8165 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8166 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8167 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8168 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8169 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8170 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8171 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8172 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8173 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8174 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8175 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8176 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8177 | { } /* end */ |
| 8178 | }; |
| 8179 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8180 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 8181 | /* Output mixers */ |
| 8182 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8183 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8184 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8185 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8186 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 8187 | HDA_OUTPUT), |
| 8188 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 8189 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 8190 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 8191 | /* Output switches */ |
| 8192 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 8193 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 8194 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 8195 | /* Boost mixers */ |
| 8196 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 8197 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 8198 | /* Input mixers */ |
| 8199 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8200 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 8201 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8202 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8203 | { } /* end */ |
| 8204 | }; |
| 8205 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8206 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 8207 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8208 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8209 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8210 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8211 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8212 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8213 | { } /* end */ |
| 8214 | }; |
| 8215 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8216 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 8217 | .ops = &snd_hda_bind_vol, |
| 8218 | .values = { |
| 8219 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8220 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8221 | 0 |
| 8222 | }, |
| 8223 | }; |
| 8224 | |
| 8225 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 8226 | .ops = &snd_hda_bind_sw, |
| 8227 | .values = { |
| 8228 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8229 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8230 | 0 |
| 8231 | }, |
| 8232 | }; |
| 8233 | |
| 8234 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 8235 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8236 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8237 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8238 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8239 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8240 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8241 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8242 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8243 | { } /* end */ |
| 8244 | }; |
| 8245 | |
| 8246 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8247 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 8248 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 8249 | { |
| 8250 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8251 | /* .name = "Capture Source", */ |
| 8252 | .name = "Input Source", |
| 8253 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 8254 | .info = alc_mux_enum_info, |
| 8255 | .get = alc_mux_enum_get, |
| 8256 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8257 | }, |
| 8258 | { } /* end */ |
| 8259 | }; |
| 8260 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8261 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 8262 | { |
| 8263 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8264 | .name = "Channel Mode", |
| 8265 | .info = alc_ch_mode_info, |
| 8266 | .get = alc_ch_mode_get, |
| 8267 | .put = alc_ch_mode_put, |
| 8268 | }, |
| 8269 | { } /* end */ |
| 8270 | }; |
| 8271 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8272 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8273 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8274 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8275 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8276 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8277 | spec->autocfg.hp_pins[0] = 0x15; |
| 8278 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8279 | spec->autocfg.speaker_pins[1] = 0x17; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8280 | } |
| 8281 | |
| 8282 | /* auto-toggle front mic */ |
| 8283 | /* |
| 8284 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 8285 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8286 | 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] | 8287 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8288 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 8289 | } |
| 8290 | */ |
| 8291 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8292 | static struct hda_verb alc883_mitac_verbs[] = { |
| 8293 | /* HP */ |
| 8294 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8295 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8296 | /* Subwoofer */ |
| 8297 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8298 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8299 | |
| 8300 | /* enable unsolicited event */ |
| 8301 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8302 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 8303 | |
| 8304 | { } /* end */ |
| 8305 | }; |
| 8306 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 8307 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 8308 | /* HP */ |
| 8309 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8310 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8311 | /* Int speaker */ |
| 8312 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 8313 | |
| 8314 | /* enable unsolicited event */ |
| 8315 | /* |
| 8316 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8317 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8318 | */ |
| 8319 | |
| 8320 | { } /* end */ |
| 8321 | }; |
| 8322 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8323 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8324 | /* HP */ |
| 8325 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8326 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8327 | /* Int speaker */ |
| 8328 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8329 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8330 | |
| 8331 | /* enable unsolicited event */ |
| 8332 | {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] | 8333 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8334 | |
| 8335 | { } /* end */ |
| 8336 | }; |
| 8337 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8338 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 8339 | /* HP */ |
| 8340 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8341 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8342 | /* Subwoofer */ |
| 8343 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8344 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8345 | |
| 8346 | /* enable unsolicited event */ |
| 8347 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8348 | |
| 8349 | { } /* end */ |
| 8350 | }; |
| 8351 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8352 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8353 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8354 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8355 | |
| 8356 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8357 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8358 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8359 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 8360 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8361 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8362 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8363 | /* Connect Mic jack to CLFE */ |
| 8364 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8365 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8366 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8367 | /* Connect Line-in jack to Surround */ |
| 8368 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8369 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8370 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8371 | /* Connect HP out jack to Front */ |
| 8372 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8373 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8374 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8375 | |
| 8376 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8377 | |
| 8378 | { } /* end */ |
| 8379 | }; |
| 8380 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8381 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8382 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8383 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8384 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8385 | { } /* end */ |
| 8386 | }; |
| 8387 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8388 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8389 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8390 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8391 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8392 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8393 | { } /* end */ |
| 8394 | }; |
| 8395 | |
| 8396 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8397 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8398 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8399 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8400 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 8401 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8402 | { } /* end */ |
| 8403 | }; |
| 8404 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8405 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 8406 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8407 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8408 | |
| 8409 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8410 | |
| 8411 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8412 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8413 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8414 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8415 | { } /* end */ |
| 8416 | }; |
| 8417 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8418 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 8419 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8420 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8421 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8422 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8423 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8424 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8425 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8426 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8427 | { } /* end */ |
| 8428 | }; |
| 8429 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8430 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 8431 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8432 | { } |
| 8433 | }; |
| 8434 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8435 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 8436 | /* HP */ |
| 8437 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8438 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8439 | |
| 8440 | /* enable unsolicited event */ |
| 8441 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8442 | |
| 8443 | { } /* end */ |
| 8444 | }; |
| 8445 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8446 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8447 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8448 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8449 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8450 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8451 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8452 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8453 | spec->autocfg.speaker_pins[2] = 0x18; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8454 | } |
| 8455 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8456 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8457 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 8458 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 8459 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8460 | {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] | 8461 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8462 | }; |
| 8463 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8464 | /* |
| 8465 | * 2ch mode |
| 8466 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8467 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8468 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8469 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8470 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8471 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8472 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8473 | }; |
| 8474 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8475 | /* |
| 8476 | * 4ch mode |
| 8477 | */ |
| 8478 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 8479 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8480 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8481 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8482 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8483 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8484 | { } /* end */ |
| 8485 | }; |
| 8486 | |
| 8487 | /* |
| 8488 | * 6ch mode |
| 8489 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8490 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8491 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8492 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8493 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8494 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8495 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8496 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8497 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8498 | }; |
| 8499 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8500 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8501 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8502 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8503 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8504 | }; |
| 8505 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8506 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 8507 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 8508 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8509 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8510 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8511 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8512 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8513 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8514 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8515 | } |
| 8516 | |
| 8517 | /* toggle RCA according to the front-jack state */ |
| 8518 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 8519 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8520 | unsigned int present = snd_hda_jack_detect(codec, 0x14); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8521 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8522 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8523 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8524 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8525 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8526 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 8527 | unsigned int res) |
| 8528 | { |
| 8529 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8530 | alc888_lenovo_ms7195_front_automute(codec); |
| 8531 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8532 | alc888_lenovo_ms7195_rca_automute(codec); |
| 8533 | } |
| 8534 | |
| 8535 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8536 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8537 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8538 | |
| 8539 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8540 | |
| 8541 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8542 | { } /* end */ |
| 8543 | }; |
| 8544 | |
| 8545 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8546 | static void alc883_medion_md2_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8547 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8548 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8549 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8550 | spec->autocfg.hp_pins[0] = 0x14; |
| 8551 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8552 | } |
| 8553 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8554 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8555 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 8556 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8557 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8558 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8559 | { |
| 8560 | unsigned int present; |
| 8561 | |
Takashi Iwai | d56757a | 2009-11-18 08:00:14 +0100 | [diff] [blame] | 8562 | present = snd_hda_jack_detect(codec, 0x18); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8563 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8564 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8565 | } |
| 8566 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8567 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8568 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8569 | struct alc_spec *spec = codec->spec; |
| 8570 | |
| 8571 | spec->autocfg.hp_pins[0] = 0x15; |
| 8572 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8573 | } |
| 8574 | |
| 8575 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 8576 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8577 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8578 | alc883_clevo_m720_mic_automute(codec); |
| 8579 | } |
| 8580 | |
| 8581 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8582 | unsigned int res) |
| 8583 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8584 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8585 | case ALC880_MIC_EVENT: |
| 8586 | alc883_clevo_m720_mic_automute(codec); |
| 8587 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8588 | default: |
| 8589 | alc_automute_amp_unsol_event(codec, res); |
| 8590 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8591 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8592 | } |
| 8593 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8594 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8595 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8596 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8597 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8598 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8599 | spec->autocfg.hp_pins[0] = 0x14; |
| 8600 | spec->autocfg.speaker_pins[0] = 0x15; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8601 | } |
| 8602 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8603 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8604 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8605 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8606 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8607 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8608 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8609 | } |
| 8610 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8611 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 8612 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8613 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8614 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8615 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8616 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8617 | } |
| 8618 | |
| 8619 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 8620 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8621 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8622 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8623 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8624 | HDA_AMP_MUTE, bits); |
| 8625 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8626 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8627 | } |
| 8628 | |
| 8629 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 8630 | unsigned int res) |
| 8631 | { |
| 8632 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8633 | alc883_lenovo_101e_all_automute(codec); |
| 8634 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8635 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 8636 | } |
| 8637 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8638 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8639 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8640 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8641 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8642 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8643 | spec->autocfg.hp_pins[0] = 0x14; |
| 8644 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8645 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8646 | } |
| 8647 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8648 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 8649 | /* HP Pin: output 0 (0x0c) */ |
| 8650 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8651 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8652 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8653 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8654 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8655 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8656 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8657 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8658 | /* eanable EAPD on medion laptop */ |
| 8659 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8660 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8661 | /* enable unsolicited event */ |
| 8662 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8663 | { } |
| 8664 | }; |
| 8665 | |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 8666 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 8667 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8668 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8669 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8670 | { } /* end */ |
| 8671 | }; |
| 8672 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8673 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8674 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8675 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8676 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8677 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8678 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8679 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8680 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8681 | spec->autocfg.speaker_pins[3] = 0x17; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8682 | } |
| 8683 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8684 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8685 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8686 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8687 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8688 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8689 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8690 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8691 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8692 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8693 | spec->autocfg.speaker_pins[4] = 0x1a; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8694 | } |
| 8695 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8696 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8697 | { |
| 8698 | struct alc_spec *spec = codec->spec; |
| 8699 | |
| 8700 | spec->autocfg.hp_pins[0] = 0x15; |
| 8701 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8702 | spec->autocfg.speaker_pins[1] = 0x17; |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8703 | } |
| 8704 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8705 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8706 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8707 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8708 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8709 | /* enable unsolicited event */ |
| 8710 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8711 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8712 | { } /* end */ |
| 8713 | }; |
| 8714 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8715 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8716 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8717 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8718 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8719 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8720 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8721 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8722 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8723 | spec->ext_mic.pin = 0x18; |
| 8724 | spec->int_mic.pin = 0x19; |
| 8725 | spec->ext_mic.mux_idx = 0; |
| 8726 | spec->int_mic.mux_idx = 1; |
| 8727 | spec->auto_mic = 1; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8728 | } |
| 8729 | |
| 8730 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8731 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8732 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8733 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8734 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8735 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8736 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8737 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8738 | /* enable unsolicited event */ |
| 8739 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8740 | { } /* end */ |
| 8741 | }; |
| 8742 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8743 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8744 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8745 | struct alc_spec *spec = codec->spec; |
| 8746 | |
| 8747 | spec->autocfg.hp_pins[0] = 0x14; |
| 8748 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 8749 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8750 | } |
| 8751 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8752 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 8753 | /* Init rear pin (used as headphone output) */ |
| 8754 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 8755 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 8756 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8757 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 8758 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 8759 | /* Init line 2 pin (used as headphone out by default) */ |
| 8760 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 8761 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 8762 | { } /* end */ |
| 8763 | }; |
| 8764 | |
| 8765 | /* Mute speakers according to the headphone jack state */ |
| 8766 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 8767 | { |
| 8768 | unsigned int present; |
| 8769 | |
| 8770 | /* Mute only in 2ch or 4ch mode */ |
| 8771 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 8772 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8773 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8774 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8775 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8776 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8777 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8778 | } |
| 8779 | } |
| 8780 | |
| 8781 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8782 | { |
| 8783 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8784 | alc889A_mb31_automute(codec); |
| 8785 | } |
| 8786 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8787 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8788 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8789 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8790 | #endif |
| 8791 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 8792 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8793 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 8794 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 8795 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 8796 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 8797 | |
| 8798 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 8799 | ALC1200_DIGOUT_NID, 0, |
| 8800 | }; |
| 8801 | |
| 8802 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 8803 | ALC883_DIGOUT_NID, 0, |
| 8804 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8805 | |
| 8806 | /* |
| 8807 | * configuration and preset |
| 8808 | */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8809 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 8810 | [ALC882_3ST_DIG] = "3stack-dig", |
| 8811 | [ALC882_6ST_DIG] = "6stack-dig", |
| 8812 | [ALC882_ARIMA] = "arima", |
| 8813 | [ALC882_W2JC] = "w2jc", |
| 8814 | [ALC882_TARGA] = "targa", |
| 8815 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 8816 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 8817 | [ALC885_MACPRO] = "macpro", |
| 8818 | [ALC885_MB5] = "mb5", |
| 8819 | [ALC885_MBP3] = "mbp3", |
| 8820 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8821 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8822 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8823 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8824 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8825 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8826 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8827 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8828 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8829 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8830 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8831 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 8832 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8833 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 8834 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8835 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8836 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8837 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8838 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8839 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8840 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8841 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8842 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8843 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8844 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8845 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 8846 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8847 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8848 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8849 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8850 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8851 | [ALC889A_INTEL] = "intel-alc889a", |
| 8852 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8853 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8854 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8855 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8856 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8857 | }; |
| 8858 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8859 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 8860 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 8861 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8862 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 8863 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 8864 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8865 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8866 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8867 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8868 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 8869 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8870 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 8871 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8872 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 8873 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 8874 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 8875 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8876 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 8877 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8878 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 8879 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 8880 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8881 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 8882 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 8883 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 8884 | /* default Acer -- disabled as it causes more problems. |
| 8885 | * model=auto should work fine now |
| 8886 | */ |
| 8887 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8888 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8889 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8890 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8891 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8892 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8893 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8894 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 8895 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 8896 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8897 | |
| 8898 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 8899 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 8900 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 8901 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8902 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 8903 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 8904 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8905 | 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] | 8906 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8907 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8908 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8909 | |
| 8910 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 8911 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8912 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8913 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8914 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8915 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8916 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8917 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8918 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 8919 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8920 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8921 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8922 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8923 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8924 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8925 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8926 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8927 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8928 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8929 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8930 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8931 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8932 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8933 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 8934 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8935 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8936 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8937 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8938 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8939 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8940 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8941 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 8942 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8943 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8944 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8945 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 8946 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8947 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 8948 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8949 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8950 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8951 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 8952 | 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] | 8953 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 8954 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 8955 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8956 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8957 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8958 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 8959 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8960 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8961 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8962 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8963 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8964 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 8965 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8966 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8967 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 8968 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 8969 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8970 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8971 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8972 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 8973 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8974 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8975 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 8976 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 8977 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8978 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8979 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8980 | {} |
| 8981 | }; |
| 8982 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8983 | /* codec SSID table for Intel Mac */ |
| 8984 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 8985 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 8986 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 8987 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 8988 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 8989 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 8990 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 8991 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
| 8992 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 8993 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 8994 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8995 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8996 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 8997 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 8998 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8999 | */ |
| 9000 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9001 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9002 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9003 | }; |
| 9004 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9005 | static struct alc_config_preset alc882_presets[] = { |
| 9006 | [ALC882_3ST_DIG] = { |
| 9007 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9008 | .init_verbs = { alc882_base_init_verbs, |
| 9009 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9010 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9011 | .dac_nids = alc882_dac_nids, |
| 9012 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9013 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9014 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9015 | .channel_mode = alc882_ch_modes, |
| 9016 | .need_dac_fix = 1, |
| 9017 | .input_mux = &alc882_capture_source, |
| 9018 | }, |
| 9019 | [ALC882_6ST_DIG] = { |
| 9020 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9021 | .init_verbs = { alc882_base_init_verbs, |
| 9022 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9023 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9024 | .dac_nids = alc882_dac_nids, |
| 9025 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9026 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9027 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9028 | .channel_mode = alc882_sixstack_modes, |
| 9029 | .input_mux = &alc882_capture_source, |
| 9030 | }, |
| 9031 | [ALC882_ARIMA] = { |
| 9032 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9033 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9034 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9035 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9036 | .dac_nids = alc882_dac_nids, |
| 9037 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9038 | .channel_mode = alc882_sixstack_modes, |
| 9039 | .input_mux = &alc882_capture_source, |
| 9040 | }, |
| 9041 | [ALC882_W2JC] = { |
| 9042 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9043 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9044 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9045 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9046 | .dac_nids = alc882_dac_nids, |
| 9047 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9048 | .channel_mode = alc880_threestack_modes, |
| 9049 | .need_dac_fix = 1, |
| 9050 | .input_mux = &alc882_capture_source, |
| 9051 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9052 | }, |
| 9053 | [ALC885_MBP3] = { |
| 9054 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 9055 | .init_verbs = { alc885_mbp3_init_verbs, |
| 9056 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9057 | .num_dacs = 2, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9058 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9059 | .hp_nid = 0x04, |
| 9060 | .channel_mode = alc885_mbp_4ch_modes, |
| 9061 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9062 | .input_mux = &alc882_capture_source, |
| 9063 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9064 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9065 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9066 | .setup = alc885_mbp3_setup, |
| 9067 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9068 | }, |
| 9069 | [ALC885_MB5] = { |
| 9070 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 9071 | .init_verbs = { alc885_mb5_init_verbs, |
| 9072 | alc880_gpio1_init_verbs }, |
| 9073 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9074 | .dac_nids = alc882_dac_nids, |
| 9075 | .channel_mode = alc885_mb5_6ch_modes, |
| 9076 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 9077 | .input_mux = &mb5_capture_source, |
| 9078 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9079 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9080 | }, |
| 9081 | [ALC885_MACPRO] = { |
| 9082 | .mixers = { alc882_macpro_mixer }, |
| 9083 | .init_verbs = { alc882_macpro_init_verbs }, |
| 9084 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9085 | .dac_nids = alc882_dac_nids, |
| 9086 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9087 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9088 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9089 | .channel_mode = alc882_ch_modes, |
| 9090 | .input_mux = &alc882_capture_source, |
| 9091 | .init_hook = alc885_macpro_init_hook, |
| 9092 | }, |
| 9093 | [ALC885_IMAC24] = { |
| 9094 | .mixers = { alc885_imac24_mixer }, |
| 9095 | .init_verbs = { alc885_imac24_init_verbs }, |
| 9096 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9097 | .dac_nids = alc882_dac_nids, |
| 9098 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9099 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9100 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9101 | .channel_mode = alc882_ch_modes, |
| 9102 | .input_mux = &alc882_capture_source, |
| 9103 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9104 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9105 | .init_hook = alc885_imac24_init_hook, |
| 9106 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9107 | [ALC885_IMAC91] = { |
| 9108 | .mixers = { alc885_imac91_mixer, alc882_chmode_mixer }, |
| 9109 | .init_verbs = { alc885_imac91_init_verbs, |
| 9110 | alc880_gpio1_init_verbs }, |
| 9111 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9112 | .dac_nids = alc882_dac_nids, |
| 9113 | .channel_mode = alc885_mbp_4ch_modes, |
| 9114 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
| 9115 | .input_mux = &alc882_capture_source, |
| 9116 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9117 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9118 | .unsol_event = alc885_imac91_unsol_event, |
| 9119 | .init_hook = alc885_imac91_automute, |
| 9120 | }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9121 | [ALC882_TARGA] = { |
| 9122 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9123 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 9124 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9125 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9126 | .dac_nids = alc882_dac_nids, |
| 9127 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9128 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9129 | .adc_nids = alc882_adc_nids, |
| 9130 | .capsrc_nids = alc882_capsrc_nids, |
| 9131 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9132 | .channel_mode = alc882_3ST_6ch_modes, |
| 9133 | .need_dac_fix = 1, |
| 9134 | .input_mux = &alc882_capture_source, |
| 9135 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9136 | .setup = alc882_targa_setup, |
| 9137 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9138 | }, |
| 9139 | [ALC882_ASUS_A7J] = { |
| 9140 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9141 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9142 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9143 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9144 | .dac_nids = alc882_dac_nids, |
| 9145 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9146 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9147 | .adc_nids = alc882_adc_nids, |
| 9148 | .capsrc_nids = alc882_capsrc_nids, |
| 9149 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9150 | .channel_mode = alc882_3ST_6ch_modes, |
| 9151 | .need_dac_fix = 1, |
| 9152 | .input_mux = &alc882_capture_source, |
| 9153 | }, |
| 9154 | [ALC882_ASUS_A7M] = { |
| 9155 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9156 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9157 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9158 | alc882_asus_a7m_verbs }, |
| 9159 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9160 | .dac_nids = alc882_dac_nids, |
| 9161 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9162 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9163 | .channel_mode = alc880_threestack_modes, |
| 9164 | .need_dac_fix = 1, |
| 9165 | .input_mux = &alc882_capture_source, |
| 9166 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9167 | [ALC883_3ST_2ch_DIG] = { |
| 9168 | .mixers = { alc883_3ST_2ch_mixer }, |
| 9169 | .init_verbs = { alc883_init_verbs }, |
| 9170 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9171 | .dac_nids = alc883_dac_nids, |
| 9172 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9173 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9174 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9175 | .channel_mode = alc883_3ST_2ch_modes, |
| 9176 | .input_mux = &alc883_capture_source, |
| 9177 | }, |
| 9178 | [ALC883_3ST_6ch_DIG] = { |
| 9179 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9180 | .init_verbs = { alc883_init_verbs }, |
| 9181 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9182 | .dac_nids = alc883_dac_nids, |
| 9183 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9184 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9185 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9186 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9187 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9188 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9189 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9190 | [ALC883_3ST_6ch] = { |
| 9191 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9192 | .init_verbs = { alc883_init_verbs }, |
| 9193 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9194 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9195 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9196 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9197 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9198 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9199 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9200 | [ALC883_3ST_6ch_INTEL] = { |
| 9201 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 9202 | .init_verbs = { alc883_init_verbs }, |
| 9203 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9204 | .dac_nids = alc883_dac_nids, |
| 9205 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9206 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9207 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9208 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 9209 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 9210 | .need_dac_fix = 1, |
| 9211 | .input_mux = &alc883_3stack_6ch_intel, |
| 9212 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9213 | [ALC889A_INTEL] = { |
| 9214 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9215 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 9216 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9217 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9218 | .dac_nids = alc883_dac_nids, |
| 9219 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9220 | .adc_nids = alc889_adc_nids, |
| 9221 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9222 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9223 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9224 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9225 | .channel_mode = alc889_8ch_intel_modes, |
| 9226 | .capsrc_nids = alc889_capsrc_nids, |
| 9227 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9228 | .setup = alc889_automute_setup, |
| 9229 | .init_hook = alc_automute_amp, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9230 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9231 | .need_dac_fix = 1, |
| 9232 | }, |
| 9233 | [ALC889_INTEL] = { |
| 9234 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 9235 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9236 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9237 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9238 | .dac_nids = alc883_dac_nids, |
| 9239 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9240 | .adc_nids = alc889_adc_nids, |
| 9241 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9242 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9243 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9244 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9245 | .channel_mode = alc889_8ch_intel_modes, |
| 9246 | .capsrc_nids = alc889_capsrc_nids, |
| 9247 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9248 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9249 | .init_hook = alc889_intel_init_hook, |
| 9250 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9251 | .need_dac_fix = 1, |
| 9252 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9253 | [ALC883_6ST_DIG] = { |
| 9254 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9255 | .init_verbs = { alc883_init_verbs }, |
| 9256 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9257 | .dac_nids = alc883_dac_nids, |
| 9258 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9259 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9260 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9261 | .channel_mode = alc883_sixstack_modes, |
| 9262 | .input_mux = &alc883_capture_source, |
| 9263 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9264 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9265 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9266 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9267 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9268 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9269 | .dac_nids = alc883_dac_nids, |
| 9270 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9271 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9272 | .channel_mode = alc883_3ST_6ch_modes, |
| 9273 | .need_dac_fix = 1, |
| 9274 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9275 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9276 | .setup = alc882_targa_setup, |
| 9277 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9278 | }, |
| 9279 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9280 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9281 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9282 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9283 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9284 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9285 | .adc_nids = alc883_adc_nids_alt, |
| 9286 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9287 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9288 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9289 | .channel_mode = alc883_3ST_2ch_modes, |
| 9290 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9291 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9292 | .setup = alc882_targa_setup, |
| 9293 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9294 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9295 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9296 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 9297 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9298 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9299 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9300 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9301 | .dac_nids = alc883_dac_nids, |
| 9302 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9303 | .adc_nids = alc883_adc_nids_rev, |
| 9304 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9305 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9306 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9307 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 9308 | .channel_mode = alc883_4ST_8ch_modes, |
| 9309 | .need_dac_fix = 1, |
| 9310 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9311 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9312 | .setup = alc882_targa_setup, |
| 9313 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9314 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9315 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9316 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9317 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 9318 | * and the headphone jack. Turn this on and rely on the |
| 9319 | * standard mute methods whenever the user wants to turn |
| 9320 | * these outputs off. |
| 9321 | */ |
| 9322 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 9323 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9324 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9325 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9326 | .channel_mode = alc883_3ST_2ch_modes, |
| 9327 | .input_mux = &alc883_capture_source, |
| 9328 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9329 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9330 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9331 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9332 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9333 | .dac_nids = alc883_dac_nids, |
| 9334 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9335 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9336 | .channel_mode = alc883_3ST_2ch_modes, |
| 9337 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9338 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9339 | .setup = alc883_acer_aspire_setup, |
| 9340 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9341 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9342 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9343 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9344 | alc883_chmode_mixer }, |
| 9345 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9346 | alc888_acer_aspire_4930g_verbs }, |
| 9347 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9348 | .dac_nids = alc883_dac_nids, |
| 9349 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9350 | .adc_nids = alc883_adc_nids_rev, |
| 9351 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9352 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9353 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9354 | .channel_mode = alc883_3ST_6ch_modes, |
| 9355 | .need_dac_fix = 1, |
| 9356 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9357 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9358 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9359 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9360 | .setup = alc888_acer_aspire_4930g_setup, |
| 9361 | .init_hook = alc_automute_amp, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9362 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9363 | [ALC888_ACER_ASPIRE_6530G] = { |
| 9364 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 9365 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9366 | alc888_acer_aspire_6530g_verbs }, |
| 9367 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9368 | .dac_nids = alc883_dac_nids, |
| 9369 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9370 | .adc_nids = alc883_adc_nids_rev, |
| 9371 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9372 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9373 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9374 | .channel_mode = alc883_3ST_2ch_modes, |
| 9375 | .num_mux_defs = |
| 9376 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9377 | .input_mux = alc888_acer_aspire_6530_sources, |
| 9378 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9379 | .setup = alc888_acer_aspire_6530g_setup, |
| 9380 | .init_hook = alc_automute_amp, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9381 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9382 | [ALC888_ACER_ASPIRE_8930G] = { |
| 9383 | .mixers = { alc888_base_mixer, |
| 9384 | alc883_chmode_mixer }, |
| 9385 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9386 | alc889_acer_aspire_8930g_verbs }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9387 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9388 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9389 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9390 | .adc_nids = alc889_adc_nids, |
| 9391 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9392 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9393 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9394 | .channel_mode = alc883_3ST_6ch_modes, |
| 9395 | .need_dac_fix = 1, |
| 9396 | .const_channel_count = 6, |
| 9397 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9398 | ARRAY_SIZE(alc889_capture_sources), |
| 9399 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9400 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9401 | .setup = alc889_acer_aspire_8930g_setup, |
| 9402 | .init_hook = alc_automute_amp, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9403 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9404 | [ALC888_ACER_ASPIRE_7730G] = { |
| 9405 | .mixers = { alc883_3ST_6ch_mixer, |
| 9406 | alc883_chmode_mixer }, |
| 9407 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9408 | alc888_acer_aspire_7730G_verbs }, |
| 9409 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9410 | .dac_nids = alc883_dac_nids, |
| 9411 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9412 | .adc_nids = alc883_adc_nids_rev, |
| 9413 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9414 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9415 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9416 | .channel_mode = alc883_3ST_6ch_modes, |
| 9417 | .need_dac_fix = 1, |
| 9418 | .const_channel_count = 6, |
| 9419 | .input_mux = &alc883_capture_source, |
| 9420 | .unsol_event = alc_automute_amp_unsol_event, |
| 9421 | .setup = alc888_acer_aspire_6530g_setup, |
| 9422 | .init_hook = alc_automute_amp, |
| 9423 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9424 | [ALC883_MEDION] = { |
| 9425 | .mixers = { alc883_fivestack_mixer, |
| 9426 | alc883_chmode_mixer }, |
| 9427 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9428 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9429 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9430 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9431 | .adc_nids = alc883_adc_nids_alt, |
| 9432 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9433 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9434 | .channel_mode = alc883_sixstack_modes, |
| 9435 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9436 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9437 | [ALC883_MEDION_MD2] = { |
| 9438 | .mixers = { alc883_medion_md2_mixer}, |
| 9439 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 9440 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9441 | .dac_nids = alc883_dac_nids, |
| 9442 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9443 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9444 | .channel_mode = alc883_3ST_2ch_modes, |
| 9445 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9446 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9447 | .setup = alc883_medion_md2_setup, |
| 9448 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9449 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9450 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9451 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9452 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 9453 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9454 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9455 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9456 | .channel_mode = alc883_3ST_2ch_modes, |
| 9457 | .input_mux = &alc883_capture_source, |
| 9458 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9459 | [ALC883_CLEVO_M540R] = { |
| 9460 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9461 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 9462 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9463 | .dac_nids = alc883_dac_nids, |
| 9464 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9465 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9466 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 9467 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 9468 | .need_dac_fix = 1, |
| 9469 | .input_mux = &alc883_capture_source, |
| 9470 | /* This machine has the hardware HP auto-muting, thus |
| 9471 | * we need no software mute via unsol event |
| 9472 | */ |
| 9473 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9474 | [ALC883_CLEVO_M720] = { |
| 9475 | .mixers = { alc883_clevo_m720_mixer }, |
| 9476 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9477 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9478 | .dac_nids = alc883_dac_nids, |
| 9479 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9480 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9481 | .channel_mode = alc883_3ST_2ch_modes, |
| 9482 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9483 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9484 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9485 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9486 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9487 | [ALC883_LENOVO_101E_2ch] = { |
| 9488 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 9489 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 9490 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9491 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9492 | .adc_nids = alc883_adc_nids_alt, |
| 9493 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9494 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9495 | .channel_mode = alc883_3ST_2ch_modes, |
| 9496 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 9497 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 9498 | .init_hook = alc883_lenovo_101e_all_automute, |
| 9499 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9500 | [ALC883_LENOVO_NB0763] = { |
| 9501 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 9502 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 9503 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9504 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9505 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9506 | .channel_mode = alc883_3ST_2ch_modes, |
| 9507 | .need_dac_fix = 1, |
| 9508 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9509 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9510 | .setup = alc883_medion_md2_setup, |
| 9511 | .init_hook = alc_automute_amp, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9512 | }, |
| 9513 | [ALC888_LENOVO_MS7195_DIG] = { |
| 9514 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9515 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 9516 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9517 | .dac_nids = alc883_dac_nids, |
| 9518 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9519 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9520 | .channel_mode = alc883_3ST_6ch_modes, |
| 9521 | .need_dac_fix = 1, |
| 9522 | .input_mux = &alc883_capture_source, |
| 9523 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 9524 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9525 | }, |
| 9526 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9527 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9528 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 9529 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9530 | .dac_nids = alc883_dac_nids, |
| 9531 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9532 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9533 | .channel_mode = alc883_3ST_2ch_modes, |
| 9534 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9535 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9536 | .setup = alc883_haier_w66_setup, |
| 9537 | .init_hook = alc_automute_amp, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9538 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9539 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9540 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9541 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9542 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9543 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9544 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 9545 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9546 | .need_dac_fix = 1, |
| 9547 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9548 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9549 | .setup = alc888_3st_hp_setup, |
| 9550 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9551 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9552 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 9553 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9554 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 9555 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9556 | .dac_nids = alc883_dac_nids, |
| 9557 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9558 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9559 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9560 | .channel_mode = alc883_sixstack_modes, |
| 9561 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9562 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9563 | .setup = alc888_6st_dell_setup, |
| 9564 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9565 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9566 | [ALC883_MITAC] = { |
| 9567 | .mixers = { alc883_mitac_mixer }, |
| 9568 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 9569 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9570 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9571 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9572 | .channel_mode = alc883_3ST_2ch_modes, |
| 9573 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9574 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9575 | .setup = alc883_mitac_setup, |
| 9576 | .init_hook = alc_automute_amp, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9577 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9578 | [ALC883_FUJITSU_PI2515] = { |
| 9579 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 9580 | .init_verbs = { alc883_init_verbs, |
| 9581 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 9582 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9583 | .dac_nids = alc883_dac_nids, |
| 9584 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9585 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9586 | .channel_mode = alc883_3ST_2ch_modes, |
| 9587 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9588 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9589 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
| 9590 | .init_hook = alc_automute_amp, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9591 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9592 | [ALC888_FUJITSU_XA3530] = { |
| 9593 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 9594 | .init_verbs = { alc883_init_verbs, |
| 9595 | alc888_fujitsu_xa3530_verbs }, |
| 9596 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9597 | .dac_nids = alc883_dac_nids, |
| 9598 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9599 | .adc_nids = alc883_adc_nids_rev, |
| 9600 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9601 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9602 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 9603 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 9604 | .num_mux_defs = |
| 9605 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9606 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9607 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9608 | .setup = alc888_fujitsu_xa3530_setup, |
| 9609 | .init_hook = alc_automute_amp, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9610 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9611 | [ALC888_LENOVO_SKY] = { |
| 9612 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 9613 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 9614 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9615 | .dac_nids = alc883_dac_nids, |
| 9616 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9617 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9618 | .channel_mode = alc883_sixstack_modes, |
| 9619 | .need_dac_fix = 1, |
| 9620 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9621 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9622 | .setup = alc888_lenovo_sky_setup, |
| 9623 | .init_hook = alc_automute_amp, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9624 | }, |
| 9625 | [ALC888_ASUS_M90V] = { |
| 9626 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9627 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 9628 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9629 | .dac_nids = alc883_dac_nids, |
| 9630 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9631 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9632 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9633 | .channel_mode = alc883_3ST_6ch_modes, |
| 9634 | .need_dac_fix = 1, |
| 9635 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9636 | .unsol_event = alc_sku_unsol_event, |
| 9637 | .setup = alc883_mode2_setup, |
| 9638 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9639 | }, |
| 9640 | [ALC888_ASUS_EEE1601] = { |
| 9641 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9642 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9643 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 9644 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9645 | .dac_nids = alc883_dac_nids, |
| 9646 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9647 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9648 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9649 | .channel_mode = alc883_3ST_2ch_modes, |
| 9650 | .need_dac_fix = 1, |
| 9651 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9652 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9653 | .init_hook = alc883_eee1601_inithook, |
| 9654 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9655 | [ALC1200_ASUS_P5Q] = { |
| 9656 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9657 | .init_verbs = { alc883_init_verbs }, |
| 9658 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9659 | .dac_nids = alc883_dac_nids, |
| 9660 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 9661 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 9662 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9663 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9664 | .channel_mode = alc883_sixstack_modes, |
| 9665 | .input_mux = &alc883_capture_source, |
| 9666 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9667 | [ALC889A_MB31] = { |
| 9668 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 9669 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 9670 | alc880_gpio1_init_verbs }, |
| 9671 | .adc_nids = alc883_adc_nids, |
| 9672 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 9673 | .dac_nids = alc883_dac_nids, |
| 9674 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9675 | .channel_mode = alc889A_mb31_6ch_modes, |
| 9676 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 9677 | .input_mux = &alc889A_mb31_capture_source, |
| 9678 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9679 | .unsol_event = alc889A_mb31_unsol_event, |
| 9680 | .init_hook = alc889A_mb31_automute, |
| 9681 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9682 | [ALC883_SONY_VAIO_TT] = { |
| 9683 | .mixers = { alc883_vaiott_mixer }, |
| 9684 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 9685 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9686 | .dac_nids = alc883_dac_nids, |
| 9687 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9688 | .channel_mode = alc883_3ST_2ch_modes, |
| 9689 | .input_mux = &alc883_capture_source, |
| 9690 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9691 | .setup = alc883_vaiott_setup, |
| 9692 | .init_hook = alc_automute_amp, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9693 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9694 | }; |
| 9695 | |
| 9696 | |
| 9697 | /* |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9698 | * Pin config fixes |
| 9699 | */ |
| 9700 | enum { |
| 9701 | PINFIX_ABIT_AW9D_MAX |
| 9702 | }; |
| 9703 | |
| 9704 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 9705 | { 0x15, 0x01080104 }, /* side */ |
| 9706 | { 0x16, 0x01011012 }, /* rear */ |
| 9707 | { 0x17, 0x01016011 }, /* clfe */ |
| 9708 | { } |
| 9709 | }; |
| 9710 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 9711 | static const struct alc_fixup alc882_fixups[] = { |
| 9712 | [PINFIX_ABIT_AW9D_MAX] = { |
| 9713 | .pins = alc882_abit_aw9d_pinfix |
| 9714 | }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9715 | }; |
| 9716 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 9717 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9718 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 9719 | {} |
| 9720 | }; |
| 9721 | |
| 9722 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9723 | * BIOS auto configuration |
| 9724 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9725 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 9726 | const struct auto_pin_cfg *cfg) |
| 9727 | { |
| 9728 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 9729 | } |
| 9730 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9731 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9732 | hda_nid_t nid, int pin_type, |
| 9733 | int dac_idx) |
| 9734 | { |
| 9735 | /* set as output */ |
| 9736 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9737 | int idx; |
| 9738 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9739 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9740 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 9741 | idx = 4; |
| 9742 | else |
| 9743 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9744 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 9745 | |
| 9746 | } |
| 9747 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9748 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9749 | { |
| 9750 | struct alc_spec *spec = codec->spec; |
| 9751 | int i; |
| 9752 | |
| 9753 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9754 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9755 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9756 | if (nid) |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9757 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9758 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9759 | } |
| 9760 | } |
| 9761 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9762 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9763 | { |
| 9764 | struct alc_spec *spec = codec->spec; |
| 9765 | hda_nid_t pin; |
| 9766 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9767 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9768 | if (pin) /* connect to front */ |
| 9769 | /* use dac 0 */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9770 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9771 | pin = spec->autocfg.speaker_pins[0]; |
| 9772 | if (pin) |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9773 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9774 | } |
| 9775 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9776 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9777 | { |
| 9778 | struct alc_spec *spec = codec->spec; |
| 9779 | int i; |
| 9780 | |
| 9781 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9782 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9783 | if (!nid) |
| 9784 | continue; |
Takashi Iwai | 0d971c9 | 2009-06-30 16:11:11 +0200 | [diff] [blame] | 9785 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9786 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 9787 | snd_hda_codec_write(codec, nid, 0, |
| 9788 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9789 | AMP_OUT_MUTE); |
| 9790 | } |
| 9791 | } |
| 9792 | |
| 9793 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 9794 | { |
| 9795 | struct alc_spec *spec = codec->spec; |
| 9796 | int c; |
| 9797 | |
| 9798 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 9799 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 9800 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 9801 | unsigned int mux_idx; |
| 9802 | const struct hda_input_mux *imux; |
| 9803 | int conns, mute, idx, item; |
| 9804 | |
| 9805 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 9806 | ARRAY_SIZE(conn_list)); |
| 9807 | if (conns < 0) |
| 9808 | continue; |
| 9809 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 9810 | imux = &spec->input_mux[mux_idx]; |
| 9811 | for (idx = 0; idx < conns; idx++) { |
| 9812 | /* if the current connection is the selected one, |
| 9813 | * unmute it as default - otherwise mute it |
| 9814 | */ |
| 9815 | mute = AMP_IN_MUTE(idx); |
| 9816 | for (item = 0; item < imux->num_items; item++) { |
| 9817 | if (imux->items[item].index == idx) { |
| 9818 | if (spec->cur_mux[c] == item) |
| 9819 | mute = AMP_IN_UNMUTE(idx); |
| 9820 | break; |
| 9821 | } |
| 9822 | } |
| 9823 | /* check if we have a selector or mixer |
| 9824 | * we could check for the widget type instead, but |
| 9825 | * just check for Amp-In presence (in case of mixer |
| 9826 | * without amp-in there is something wrong, this |
| 9827 | * function shouldn't be used or capsrc nid is wrong) |
| 9828 | */ |
| 9829 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9830 | snd_hda_codec_write(codec, nid, 0, |
| 9831 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9832 | mute); |
| 9833 | else if (mute != AMP_IN_MUTE(idx)) |
| 9834 | snd_hda_codec_write(codec, nid, 0, |
| 9835 | AC_VERB_SET_CONNECT_SEL, |
| 9836 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9837 | } |
| 9838 | } |
| 9839 | } |
| 9840 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9841 | /* add mic boosts if needed */ |
| 9842 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9843 | { |
| 9844 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9845 | int err; |
| 9846 | hda_nid_t nid; |
| 9847 | |
| 9848 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 9849 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 9850 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9851 | "Mic Boost", |
| 9852 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9853 | if (err < 0) |
| 9854 | return err; |
| 9855 | } |
| 9856 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 9857 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 9858 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9859 | "Front Mic Boost", |
| 9860 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9861 | if (err < 0) |
| 9862 | return err; |
| 9863 | } |
| 9864 | return 0; |
| 9865 | } |
| 9866 | |
| 9867 | /* almost identical with ALC880 parser... */ |
| 9868 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 9869 | { |
| 9870 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9871 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
| 9872 | int i, err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9873 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9874 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9875 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9876 | if (err < 0) |
| 9877 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9878 | if (!spec->autocfg.line_outs) |
| 9879 | return 0; /* can't find valid BIOS pin config */ |
| 9880 | |
| 9881 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 9882 | if (err < 0) |
| 9883 | return err; |
| 9884 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9885 | if (err < 0) |
| 9886 | return err; |
| 9887 | err = alc880_auto_create_extra_out(spec, |
| 9888 | spec->autocfg.speaker_pins[0], |
| 9889 | "Speaker"); |
| 9890 | if (err < 0) |
| 9891 | return err; |
| 9892 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 9893 | "Headphone"); |
| 9894 | if (err < 0) |
| 9895 | return err; |
| 9896 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 9897 | if (err < 0) |
| 9898 | return err; |
| 9899 | |
| 9900 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 9901 | |
| 9902 | /* check multiple SPDIF-out (for recent codecs) */ |
| 9903 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 9904 | hda_nid_t dig_nid; |
| 9905 | err = snd_hda_get_connections(codec, |
| 9906 | spec->autocfg.dig_out_pins[i], |
| 9907 | &dig_nid, 1); |
| 9908 | if (err < 0) |
| 9909 | continue; |
| 9910 | if (!i) |
| 9911 | spec->multiout.dig_out_nid = dig_nid; |
| 9912 | else { |
| 9913 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 9914 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9915 | break; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 9916 | spec->slave_dig_outs[i - 1] = dig_nid; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9917 | } |
| 9918 | } |
| 9919 | if (spec->autocfg.dig_in_pin) |
| 9920 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 9921 | |
| 9922 | if (spec->kctls.list) |
| 9923 | add_mixer(spec, spec->kctls.list); |
| 9924 | |
| 9925 | add_verb(spec, alc883_auto_init_verbs); |
| 9926 | /* if ADC 0x07 is available, initialize it, too */ |
| 9927 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 9928 | add_verb(spec, alc882_adc1_init_verbs); |
| 9929 | |
| 9930 | spec->num_mux_defs = 1; |
| 9931 | spec->input_mux = &spec->private_imux[0]; |
| 9932 | |
| 9933 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9934 | |
| 9935 | err = alc_auto_add_mic_boost(codec); |
| 9936 | if (err < 0) |
| 9937 | return err; |
| 9938 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9939 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9940 | } |
| 9941 | |
| 9942 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9943 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9944 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9945 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9946 | alc882_auto_init_multi_out(codec); |
| 9947 | alc882_auto_init_hp_out(codec); |
| 9948 | alc882_auto_init_analog_input(codec); |
| 9949 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9950 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 9951 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9952 | } |
| 9953 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9954 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9955 | { |
| 9956 | struct alc_spec *spec; |
| 9957 | int err, board_config; |
| 9958 | |
| 9959 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 9960 | if (spec == NULL) |
| 9961 | return -ENOMEM; |
| 9962 | |
| 9963 | codec->spec = spec; |
| 9964 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9965 | switch (codec->vendor_id) { |
| 9966 | case 0x10ec0882: |
| 9967 | case 0x10ec0885: |
| 9968 | break; |
| 9969 | default: |
| 9970 | /* ALC883 and variants */ |
| 9971 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 9972 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9973 | } |
| 9974 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9975 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 9976 | alc882_models, |
| 9977 | alc882_cfg_tbl); |
| 9978 | |
| 9979 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 9980 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 9981 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 9982 | |
| 9983 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 9984 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9985 | codec->chip_name); |
| 9986 | board_config = ALC882_AUTO; |
| 9987 | } |
| 9988 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 9989 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups); |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9990 | |
| 9991 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9992 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9993 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9994 | if (err < 0) { |
| 9995 | alc_free(codec); |
| 9996 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9997 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9998 | printk(KERN_INFO |
| 9999 | "hda_codec: Cannot set up configuration " |
| 10000 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10001 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10002 | } |
| 10003 | } |
| 10004 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 10005 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 10006 | if (err < 0) { |
| 10007 | alc_free(codec); |
| 10008 | return err; |
| 10009 | } |
| 10010 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10011 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 10012 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10013 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10014 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 10015 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 10016 | /* FIXME: setup DAC5 */ |
| 10017 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 10018 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 10019 | |
| 10020 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 10021 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 10022 | |
| 10023 | if (codec->vendor_id == 0x10ec0888) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 10024 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10025 | |
| 10026 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10027 | int i, j; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10028 | spec->num_adc_nids = 0; |
| 10029 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10030 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10031 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10032 | hda_nid_t items[16]; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10033 | hda_nid_t nid = alc882_adc_nids[i]; |
| 10034 | unsigned int wcap = get_wcaps(codec, nid); |
| 10035 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 10036 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10037 | if (wcap != AC_WID_AUD_IN) |
| 10038 | continue; |
| 10039 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 10040 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 10041 | if (err < 0) |
| 10042 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10043 | err = snd_hda_get_connections(codec, cap, items, |
| 10044 | ARRAY_SIZE(items)); |
| 10045 | if (err < 0) |
| 10046 | continue; |
| 10047 | for (j = 0; j < imux->num_items; j++) |
| 10048 | if (imux->items[j].index >= err) |
| 10049 | break; |
| 10050 | if (j < imux->num_items) |
| 10051 | continue; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10052 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 10053 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 10054 | } |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10055 | spec->adc_nids = spec->private_adc_nids; |
| 10056 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 10057 | } |
| 10058 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 10059 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 10060 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10061 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10062 | spec->vmaster_nid = 0x0c; |
| 10063 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10064 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10065 | if (board_config == ALC882_AUTO) |
| 10066 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10067 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10068 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10069 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10070 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 10071 | codec->proc_widget_hook = print_realtek_coef; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10072 | |
| 10073 | return 0; |
| 10074 | } |
| 10075 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10076 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10077 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10078 | * ALC262 support |
| 10079 | */ |
| 10080 | |
| 10081 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 10082 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 10083 | |
| 10084 | #define alc262_dac_nids alc260_dac_nids |
| 10085 | #define alc262_adc_nids alc882_adc_nids |
| 10086 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10087 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 10088 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10089 | |
| 10090 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 10091 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10092 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10093 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 10094 | /* ADC0 */ |
| 10095 | 0x09 |
| 10096 | }; |
| 10097 | |
| 10098 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 10099 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10100 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 10101 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10102 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10103 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10104 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10105 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10106 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10107 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10108 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10109 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10110 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10111 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10112 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10113 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 10114 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10115 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 10116 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10117 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10118 | }; |
| 10119 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10120 | /* update HP, line and mono-out pins according to the master switch */ |
| 10121 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 10122 | { |
| 10123 | struct alc_spec *spec = codec->spec; |
| 10124 | int val = spec->master_sw; |
| 10125 | |
| 10126 | /* HP & line-out */ |
| 10127 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 10128 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10129 | val ? PIN_HP : 0); |
| 10130 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10131 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10132 | val ? PIN_HP : 0); |
| 10133 | /* mono (speaker) depending on the HP jack sense */ |
| 10134 | val = val && !spec->jack_present; |
| 10135 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 10136 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10137 | val ? PIN_OUT : 0); |
| 10138 | } |
| 10139 | |
| 10140 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 10141 | { |
| 10142 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10143 | |
| 10144 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10145 | alc262_hp_master_update(codec); |
| 10146 | } |
| 10147 | |
| 10148 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10149 | { |
| 10150 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10151 | return; |
| 10152 | alc262_hp_bpc_automute(codec); |
| 10153 | } |
| 10154 | |
| 10155 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 10156 | { |
| 10157 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10158 | |
| 10159 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10160 | alc262_hp_master_update(codec); |
| 10161 | } |
| 10162 | |
| 10163 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 10164 | unsigned int res) |
| 10165 | { |
| 10166 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10167 | return; |
| 10168 | alc262_hp_wildwest_automute(codec); |
| 10169 | } |
| 10170 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10171 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10172 | |
| 10173 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10174 | struct snd_ctl_elem_value *ucontrol) |
| 10175 | { |
| 10176 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10177 | struct alc_spec *spec = codec->spec; |
| 10178 | int val = !!*ucontrol->value.integer.value; |
| 10179 | |
| 10180 | if (val == spec->master_sw) |
| 10181 | return 0; |
| 10182 | spec->master_sw = val; |
| 10183 | alc262_hp_master_update(codec); |
| 10184 | return 1; |
| 10185 | } |
| 10186 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10187 | #define ALC262_HP_MASTER_SWITCH \ |
| 10188 | { \ |
| 10189 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10190 | .name = "Master Playback Switch", \ |
| 10191 | .info = snd_ctl_boolean_mono_info, \ |
| 10192 | .get = alc262_hp_master_sw_get, \ |
| 10193 | .put = alc262_hp_master_sw_put, \ |
| 10194 | } |
| 10195 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10196 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10197 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10198 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10199 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10200 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10201 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10202 | HDA_OUTPUT), |
| 10203 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10204 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10205 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10206 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10207 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10208 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10209 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10210 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10211 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10212 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10213 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10214 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10215 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10216 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10217 | { } /* end */ |
| 10218 | }; |
| 10219 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10220 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10221 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10222 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10223 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10224 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10225 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10226 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10227 | HDA_OUTPUT), |
| 10228 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10229 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10230 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10231 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10232 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10233 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10234 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10235 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10236 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10237 | { } /* end */ |
| 10238 | }; |
| 10239 | |
| 10240 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 10241 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10242 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10243 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10244 | { } /* end */ |
| 10245 | }; |
| 10246 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10247 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10248 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10249 | { |
| 10250 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10251 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10252 | spec->autocfg.hp_pins[0] = 0x15; |
| 10253 | spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10254 | } |
| 10255 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10256 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10257 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10258 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10259 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10260 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10261 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10262 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10263 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10264 | { } /* end */ |
| 10265 | }; |
| 10266 | |
| 10267 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 10268 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10269 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10270 | |
| 10271 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10272 | { } |
| 10273 | }; |
| 10274 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10275 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 10276 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10277 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10278 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 10279 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10280 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10281 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10282 | { } /* end */ |
| 10283 | }; |
| 10284 | |
| 10285 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 10286 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10287 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10288 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10289 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10290 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10291 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10292 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10293 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10294 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10295 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10296 | {} |
| 10297 | }; |
| 10298 | |
| 10299 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 10300 | .num_items = 1, |
| 10301 | .items = { |
| 10302 | { "Line", 0x1 }, |
| 10303 | }, |
| 10304 | }; |
| 10305 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10306 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 10307 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 10308 | { |
| 10309 | struct alc_spec *spec = codec->spec; |
| 10310 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10311 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10312 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10313 | unsigned int mute; |
| 10314 | |
| 10315 | /* HP */ |
| 10316 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 10317 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 10318 | HDA_AMP_MUTE, mute); |
| 10319 | /* mute internal speaker per jack sense */ |
| 10320 | if (spec->jack_present) |
| 10321 | mute = HDA_AMP_MUTE; |
| 10322 | if (line_nid) |
| 10323 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 10324 | HDA_AMP_MUTE, mute); |
| 10325 | if (speaker_nid && speaker_nid != line_nid) |
| 10326 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 10327 | HDA_AMP_MUTE, mute); |
| 10328 | } |
| 10329 | |
| 10330 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 10331 | |
| 10332 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10333 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10334 | { |
| 10335 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10336 | struct alc_spec *spec = codec->spec; |
| 10337 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10338 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10339 | if (val == spec->master_sw) |
| 10340 | return 0; |
| 10341 | spec->master_sw = val; |
| 10342 | alc262_hippo_master_update(codec); |
| 10343 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10344 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10345 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10346 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 10347 | { \ |
| 10348 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10349 | .name = "Master Playback Switch", \ |
| 10350 | .info = snd_ctl_boolean_mono_info, \ |
| 10351 | .get = alc262_hippo_master_sw_get, \ |
| 10352 | .put = alc262_hippo_master_sw_put, \ |
| 10353 | } |
| 10354 | |
| 10355 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 10356 | ALC262_HIPPO_MASTER_SWITCH, |
| 10357 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10358 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10359 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10360 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10361 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10362 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10363 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10364 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10365 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10366 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10367 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10368 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10369 | { } /* end */ |
| 10370 | }; |
| 10371 | |
| 10372 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 10373 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10374 | ALC262_HIPPO_MASTER_SWITCH, |
| 10375 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10376 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10377 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10378 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10379 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10380 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10381 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10382 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10383 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10384 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10385 | { } /* end */ |
| 10386 | }; |
| 10387 | |
| 10388 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10389 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 10390 | { |
| 10391 | struct alc_spec *spec = codec->spec; |
| 10392 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10393 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10394 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10395 | alc262_hippo_master_update(codec); |
| 10396 | } |
| 10397 | |
| 10398 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10399 | { |
| 10400 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10401 | return; |
| 10402 | alc262_hippo_automute(codec); |
| 10403 | } |
| 10404 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10405 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10406 | { |
| 10407 | struct alc_spec *spec = codec->spec; |
| 10408 | |
| 10409 | spec->autocfg.hp_pins[0] = 0x15; |
| 10410 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10411 | } |
| 10412 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10413 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10414 | { |
| 10415 | struct alc_spec *spec = codec->spec; |
| 10416 | |
| 10417 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10418 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10419 | } |
| 10420 | |
| 10421 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10422 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10423 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10424 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10425 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10426 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10427 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10428 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10429 | { } /* end */ |
| 10430 | }; |
| 10431 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10432 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10433 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10434 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10435 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10436 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10437 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10438 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10439 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10440 | { } /* end */ |
| 10441 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10442 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10443 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 10444 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10445 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 10446 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10447 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10448 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10449 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10450 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10451 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10452 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10453 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10454 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10455 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10456 | { } /* end */ |
| 10457 | }; |
| 10458 | |
| 10459 | static struct hda_verb alc262_tyan_verbs[] = { |
| 10460 | /* Headphone automute */ |
| 10461 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10462 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10463 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10464 | |
| 10465 | /* P11 AUX_IN, white 4-pin connector */ |
| 10466 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10467 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 10468 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 10469 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 10470 | |
| 10471 | {} |
| 10472 | }; |
| 10473 | |
| 10474 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10475 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10476 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10477 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10478 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10479 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10480 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10481 | } |
| 10482 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10483 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10484 | #define alc262_capture_mixer alc882_capture_mixer |
| 10485 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 10486 | |
| 10487 | /* |
| 10488 | * generic initialization of ADC, input mixers and output mixers |
| 10489 | */ |
| 10490 | static struct hda_verb alc262_init_verbs[] = { |
| 10491 | /* |
| 10492 | * Unmute ADC0-2 and set the default input to mic-in |
| 10493 | */ |
| 10494 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10495 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10496 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10497 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10498 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10499 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10500 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10501 | /* 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] | 10502 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10503 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10504 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10505 | */ |
| 10506 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10507 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10508 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10509 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10510 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10511 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10512 | |
| 10513 | /* |
| 10514 | * Set up output mixers (0x0c - 0x0e) |
| 10515 | */ |
| 10516 | /* set vol=0 to output mixers */ |
| 10517 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10518 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10519 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10520 | /* set up input amps for analog loopback */ |
| 10521 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10522 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10523 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10524 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10525 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10526 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10527 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10528 | |
| 10529 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10530 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10531 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10532 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10533 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10534 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10535 | |
| 10536 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10537 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10538 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10539 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10540 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10541 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10542 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10543 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10544 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10545 | /* FIXME: use matrix-type input source selection */ |
| 10546 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10547 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10548 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10549 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10550 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10551 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10552 | /* Input mixer2 */ |
| 10553 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10554 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10555 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10556 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10557 | /* Input mixer3 */ |
| 10558 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10559 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10560 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10561 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10562 | |
| 10563 | { } |
| 10564 | }; |
| 10565 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10566 | static struct hda_verb alc262_eapd_verbs[] = { |
| 10567 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10568 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10569 | { } |
| 10570 | }; |
| 10571 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10572 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 10573 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10574 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10575 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10576 | |
| 10577 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10578 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10579 | {} |
| 10580 | }; |
| 10581 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10582 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 10583 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10584 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10585 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 10586 | |
| 10587 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10588 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 10589 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10590 | }; |
| 10591 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10592 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 10593 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10594 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10595 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10596 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10597 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10598 | { } /* end */ |
| 10599 | }; |
| 10600 | |
| 10601 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 10602 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10603 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10604 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10605 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10606 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 10607 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10608 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 10609 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10610 | {} |
| 10611 | }; |
| 10612 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10613 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10614 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10615 | struct alc_spec *spec = codec->spec; |
| 10616 | |
| 10617 | spec->autocfg.hp_pins[0] = 0x15; |
| 10618 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10619 | spec->ext_mic.pin = 0x18; |
| 10620 | spec->ext_mic.mux_idx = 0; |
| 10621 | spec->int_mic.pin = 0x12; |
| 10622 | spec->int_mic.mux_idx = 9; |
| 10623 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10624 | } |
| 10625 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10626 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10627 | * nec model |
| 10628 | * 0x15 = headphone |
| 10629 | * 0x16 = internal speaker |
| 10630 | * 0x18 = external mic |
| 10631 | */ |
| 10632 | |
| 10633 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 10634 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 10635 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 10636 | |
| 10637 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10638 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10639 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10640 | |
| 10641 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10642 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10643 | { } /* end */ |
| 10644 | }; |
| 10645 | |
| 10646 | static struct hda_verb alc262_nec_verbs[] = { |
| 10647 | /* Unmute Speaker */ |
| 10648 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10649 | |
| 10650 | /* Headphone */ |
| 10651 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10652 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10653 | |
| 10654 | /* External mic to headphone */ |
| 10655 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10656 | /* External mic to speaker */ |
| 10657 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10658 | {} |
| 10659 | }; |
| 10660 | |
| 10661 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10662 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10663 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 10664 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10665 | */ |
| 10666 | |
| 10667 | #define ALC_HP_EVENT 0x37 |
| 10668 | |
| 10669 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 10670 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10671 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10672 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10673 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10674 | {} |
| 10675 | }; |
| 10676 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10677 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 10678 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10679 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10680 | {} |
| 10681 | }; |
| 10682 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10683 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10684 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10685 | .items = { |
| 10686 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10687 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10688 | { "CD", 0x4 }, |
| 10689 | }, |
| 10690 | }; |
| 10691 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10692 | static struct hda_input_mux alc262_HP_capture_source = { |
| 10693 | .num_items = 5, |
| 10694 | .items = { |
| 10695 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10696 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10697 | { "Line", 0x2 }, |
| 10698 | { "CD", 0x4 }, |
| 10699 | { "AUX IN", 0x6 }, |
| 10700 | }, |
| 10701 | }; |
| 10702 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10703 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 10704 | .num_items = 4, |
| 10705 | .items = { |
| 10706 | { "Mic", 0x0 }, |
| 10707 | { "Front Mic", 0x2 }, |
| 10708 | { "Line", 0x1 }, |
| 10709 | { "CD", 0x4 }, |
| 10710 | }, |
| 10711 | }; |
| 10712 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10713 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10714 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 10715 | { |
| 10716 | struct alc_spec *spec = codec->spec; |
| 10717 | unsigned int mute; |
| 10718 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10719 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10720 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
| 10721 | snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10722 | spec->sense_updated = 1; |
| 10723 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10724 | /* unmute internal speaker only if both HPs are unplugged and |
| 10725 | * master switch is on |
| 10726 | */ |
| 10727 | if (spec->jack_present) |
| 10728 | mute = HDA_AMP_MUTE; |
| 10729 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10730 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10731 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10732 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10733 | } |
| 10734 | |
| 10735 | /* unsolicited event for HP jack sensing */ |
| 10736 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 10737 | unsigned int res) |
| 10738 | { |
| 10739 | if ((res >> 26) != ALC_HP_EVENT) |
| 10740 | return; |
| 10741 | alc262_fujitsu_automute(codec, 1); |
| 10742 | } |
| 10743 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10744 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 10745 | { |
| 10746 | alc262_fujitsu_automute(codec, 1); |
| 10747 | } |
| 10748 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10749 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10750 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 10751 | .ops = &snd_hda_bind_vol, |
| 10752 | .values = { |
| 10753 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 10754 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 10755 | 0 |
| 10756 | }, |
| 10757 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10758 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10759 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10760 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 10761 | { |
| 10762 | struct alc_spec *spec = codec->spec; |
| 10763 | unsigned int mute; |
| 10764 | |
| 10765 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10766 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10767 | spec->sense_updated = 1; |
| 10768 | } |
| 10769 | if (spec->jack_present) { |
| 10770 | /* mute internal speaker */ |
| 10771 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10772 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10773 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10774 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10775 | } else { |
| 10776 | /* unmute internal speaker if necessary */ |
| 10777 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 10778 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10779 | HDA_AMP_MUTE, mute); |
| 10780 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10781 | HDA_AMP_MUTE, mute); |
| 10782 | } |
| 10783 | } |
| 10784 | |
| 10785 | /* unsolicited event for HP jack sensing */ |
| 10786 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 10787 | unsigned int res) |
| 10788 | { |
| 10789 | if ((res >> 26) != ALC_HP_EVENT) |
| 10790 | return; |
| 10791 | alc262_lenovo_3000_automute(codec, 1); |
| 10792 | } |
| 10793 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10794 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 10795 | int dir, int idx, long *valp) |
| 10796 | { |
| 10797 | int i, change = 0; |
| 10798 | |
| 10799 | for (i = 0; i < 2; i++, valp++) |
| 10800 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 10801 | HDA_AMP_MUTE, |
| 10802 | *valp ? 0 : HDA_AMP_MUTE); |
| 10803 | return change; |
| 10804 | } |
| 10805 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10806 | /* bind hp and internal speaker mute (with plug check) */ |
| 10807 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10808 | struct snd_ctl_elem_value *ucontrol) |
| 10809 | { |
| 10810 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10811 | long *valp = ucontrol->value.integer.value; |
| 10812 | int change; |
| 10813 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10814 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 10815 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 10816 | if (change) |
| 10817 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10818 | return change; |
| 10819 | } |
| 10820 | |
| 10821 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10822 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10823 | { |
| 10824 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10825 | .name = "Master Playback Switch", |
| 10826 | .info = snd_hda_mixer_amp_switch_info, |
| 10827 | .get = snd_hda_mixer_amp_switch_get, |
| 10828 | .put = alc262_fujitsu_master_sw_put, |
| 10829 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10830 | }, |
| 10831 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10832 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10833 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10834 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10835 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10836 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10837 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10838 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10839 | { } /* end */ |
| 10840 | }; |
| 10841 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10842 | /* bind hp and internal speaker mute (with plug check) */ |
| 10843 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10844 | struct snd_ctl_elem_value *ucontrol) |
| 10845 | { |
| 10846 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10847 | long *valp = ucontrol->value.integer.value; |
| 10848 | int change; |
| 10849 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10850 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10851 | if (change) |
| 10852 | alc262_lenovo_3000_automute(codec, 0); |
| 10853 | return change; |
| 10854 | } |
| 10855 | |
| 10856 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 10857 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10858 | { |
| 10859 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10860 | .name = "Master Playback Switch", |
| 10861 | .info = snd_hda_mixer_amp_switch_info, |
| 10862 | .get = snd_hda_mixer_amp_switch_get, |
| 10863 | .put = alc262_lenovo_3000_master_sw_put, |
| 10864 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 10865 | }, |
| 10866 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10867 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10868 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10869 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10870 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10871 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10872 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10873 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10874 | { } /* end */ |
| 10875 | }; |
| 10876 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10877 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 10878 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10879 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10880 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10881 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10882 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10883 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10884 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10885 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10886 | { } /* end */ |
| 10887 | }; |
| 10888 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10889 | /* additional init verbs for Benq laptops */ |
| 10890 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 10891 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10892 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 10893 | {} |
| 10894 | }; |
| 10895 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10896 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 10897 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10898 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10899 | |
| 10900 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10901 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 10902 | {} |
| 10903 | }; |
| 10904 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10905 | /* Samsung Q1 Ultra Vista model setup */ |
| 10906 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10907 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10908 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10909 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10910 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10911 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10912 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10913 | { } /* end */ |
| 10914 | }; |
| 10915 | |
| 10916 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10917 | /* output mixer */ |
| 10918 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10919 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10920 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10921 | /* speaker */ |
| 10922 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10923 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10924 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10925 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10926 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10927 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10928 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10929 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10930 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10931 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10932 | /* internal mic */ |
| 10933 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10934 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10935 | /* ADC, choose mic */ |
| 10936 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10937 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10938 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10939 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10940 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10941 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10942 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10943 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10944 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 10945 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10946 | {} |
| 10947 | }; |
| 10948 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10949 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10950 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 10951 | { |
| 10952 | struct alc_spec *spec = codec->spec; |
| 10953 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10954 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10955 | mute = 0; |
| 10956 | /* auto-mute only when HP is used as HP */ |
| 10957 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10958 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10959 | if (spec->jack_present) |
| 10960 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10961 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10962 | /* mute/unmute internal speaker */ |
| 10963 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10964 | HDA_AMP_MUTE, mute); |
| 10965 | /* mute/unmute HP */ |
| 10966 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10967 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10968 | } |
| 10969 | |
| 10970 | /* unsolicited event for HP jack sensing */ |
| 10971 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 10972 | unsigned int res) |
| 10973 | { |
| 10974 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10975 | return; |
| 10976 | alc262_ultra_automute(codec); |
| 10977 | } |
| 10978 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10979 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 10980 | .num_items = 2, |
| 10981 | .items = { |
| 10982 | { "Mic", 0x1 }, |
| 10983 | { "Headphone", 0x7 }, |
| 10984 | }, |
| 10985 | }; |
| 10986 | |
| 10987 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10988 | struct snd_ctl_elem_value *ucontrol) |
| 10989 | { |
| 10990 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10991 | struct alc_spec *spec = codec->spec; |
| 10992 | int ret; |
| 10993 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10994 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10995 | if (!ret) |
| 10996 | return 0; |
| 10997 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 10998 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10999 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11000 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 11001 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 11002 | return ret; |
| 11003 | } |
| 11004 | |
| 11005 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 11006 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 11007 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 11008 | { |
| 11009 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11010 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11011 | .info = alc_mux_enum_info, |
| 11012 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11013 | .put = alc262_ultra_mux_enum_put, |
| 11014 | }, |
| 11015 | { } /* end */ |
| 11016 | }; |
| 11017 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11018 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 11019 | * and thus it's bound with a different mixer. |
| 11020 | * This function returns which mixer amp should be used. |
| 11021 | */ |
| 11022 | static int alc262_check_volbit(hda_nid_t nid) |
| 11023 | { |
| 11024 | if (!nid) |
| 11025 | return 0; |
| 11026 | else if (nid == 0x16) |
| 11027 | return 2; |
| 11028 | else |
| 11029 | return 1; |
| 11030 | } |
| 11031 | |
| 11032 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 11033 | const char *pfx, int *vbits) |
| 11034 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11035 | unsigned long val; |
| 11036 | int vbit; |
| 11037 | |
| 11038 | vbit = alc262_check_volbit(nid); |
| 11039 | if (!vbit) |
| 11040 | return 0; |
| 11041 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 11042 | return 0; |
| 11043 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11044 | if (vbit == 2) |
| 11045 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 11046 | else |
| 11047 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 11048 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11049 | } |
| 11050 | |
| 11051 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 11052 | const char *pfx) |
| 11053 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11054 | unsigned long val; |
| 11055 | |
| 11056 | if (!nid) |
| 11057 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11058 | if (nid == 0x16) |
| 11059 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 11060 | else |
| 11061 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 11062 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11063 | } |
| 11064 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11065 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11066 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11067 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11068 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11069 | const char *pfx; |
| 11070 | int vbits; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11071 | int err; |
| 11072 | |
| 11073 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 11074 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11075 | spec->multiout.dac_nids[0] = 2; |
| 11076 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11077 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 11078 | pfx = "Master"; |
| 11079 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11080 | pfx = "Speaker"; |
| 11081 | else |
| 11082 | pfx = "Front"; |
| 11083 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx); |
| 11084 | if (err < 0) |
| 11085 | return err; |
| 11086 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker"); |
| 11087 | if (err < 0) |
| 11088 | return err; |
| 11089 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone"); |
| 11090 | if (err < 0) |
| 11091 | return err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11092 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11093 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 11094 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 11095 | alc262_check_volbit(cfg->hp_pins[0]); |
| 11096 | if (vbits == 1 || vbits == 2) |
| 11097 | pfx = "Master"; /* only one mixer is used */ |
| 11098 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11099 | pfx = "Speaker"; |
| 11100 | else |
| 11101 | pfx = "Front"; |
| 11102 | vbits = 0; |
| 11103 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits); |
| 11104 | if (err < 0) |
| 11105 | return err; |
| 11106 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker", |
| 11107 | &vbits); |
| 11108 | if (err < 0) |
| 11109 | return err; |
| 11110 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone", |
| 11111 | &vbits); |
| 11112 | if (err < 0) |
| 11113 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11114 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11115 | } |
| 11116 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11117 | #define alc262_auto_create_input_ctls \ |
| 11118 | alc880_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11119 | |
| 11120 | /* |
| 11121 | * generic initialization of ADC, input mixers and output mixers |
| 11122 | */ |
| 11123 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 11124 | /* |
| 11125 | * Unmute ADC0-2 and set the default input to mic-in |
| 11126 | */ |
| 11127 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11128 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11129 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11130 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11131 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11132 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11133 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11134 | /* 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] | 11135 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11136 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11137 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11138 | */ |
| 11139 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11140 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11141 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11142 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11143 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11144 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11145 | |
| 11146 | /* |
| 11147 | * Set up output mixers (0x0c - 0x0f) |
| 11148 | */ |
| 11149 | /* set vol=0 to output mixers */ |
| 11150 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11151 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11152 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11153 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11154 | /* set up input amps for analog loopback */ |
| 11155 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11156 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11157 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11158 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11159 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11160 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11161 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11162 | |
| 11163 | /* FIXME: use matrix-type input source selection */ |
| 11164 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11165 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11166 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11167 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11168 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11169 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11170 | /* Input mixer2 */ |
| 11171 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11172 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11173 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11174 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11175 | /* Input mixer3 */ |
| 11176 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11177 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11178 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11179 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11180 | |
| 11181 | { } |
| 11182 | }; |
| 11183 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11184 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 11185 | /* |
| 11186 | * Unmute ADC0-2 and set the default input to mic-in |
| 11187 | */ |
| 11188 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11189 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11190 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11191 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11192 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11193 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11194 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11195 | /* 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] | 11196 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11197 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11198 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11199 | */ |
| 11200 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11201 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11202 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11203 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11204 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11205 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11206 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11207 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11208 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11209 | /* |
| 11210 | * Set up output mixers (0x0c - 0x0e) |
| 11211 | */ |
| 11212 | /* set vol=0 to output mixers */ |
| 11213 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11214 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11215 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11216 | |
| 11217 | /* set up input amps for analog loopback */ |
| 11218 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11219 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11220 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11221 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11222 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11223 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11224 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11225 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11226 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11227 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11228 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11229 | |
| 11230 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11231 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11232 | |
| 11233 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11234 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11235 | |
| 11236 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11237 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11238 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11239 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11240 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11241 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11242 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11243 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11244 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11245 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11246 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11247 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11248 | |
| 11249 | |
| 11250 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11251 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 11252 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11253 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11254 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11255 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11256 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11257 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11258 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11259 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11260 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11261 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11262 | /* Input mixer2 */ |
| 11263 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11264 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11265 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11266 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11267 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11268 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11269 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11270 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11271 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11272 | /* Input mixer3 */ |
| 11273 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11274 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11275 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11276 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11277 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11278 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11279 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11280 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11281 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11282 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11283 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11284 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11285 | { } |
| 11286 | }; |
| 11287 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11288 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 11289 | /* |
| 11290 | * Unmute ADC0-2 and set the default input to mic-in |
| 11291 | */ |
| 11292 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11293 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11294 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11295 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11296 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11297 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11298 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11299 | /* 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] | 11300 | * mixer widget |
| 11301 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 11302 | * panel mic (mic 2) |
| 11303 | */ |
| 11304 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11305 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11306 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11307 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11308 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11309 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11310 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11311 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11312 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11313 | /* |
| 11314 | * Set up output mixers (0x0c - 0x0e) |
| 11315 | */ |
| 11316 | /* set vol=0 to output mixers */ |
| 11317 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11318 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11319 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11320 | |
| 11321 | /* set up input amps for analog loopback */ |
| 11322 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11323 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11324 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11325 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11326 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11327 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11328 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11329 | |
| 11330 | |
| 11331 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 11332 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 11333 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 11334 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 11335 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11336 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 11337 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 11338 | |
| 11339 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11340 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11341 | |
| 11342 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11343 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11344 | |
| 11345 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 11346 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11347 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11348 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 11349 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11350 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11351 | |
| 11352 | /* FIXME: use matrix-type input source selection */ |
| 11353 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11354 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11355 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 11356 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 11357 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 11358 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 11359 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 11360 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11361 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 11362 | /* Input mixer2 */ |
| 11363 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11364 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11365 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11366 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11367 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11368 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11369 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11370 | /* Input mixer3 */ |
| 11371 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11372 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11373 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11374 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11375 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11376 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11377 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11378 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11379 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11380 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11381 | { } |
| 11382 | }; |
| 11383 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11384 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 11385 | |
| 11386 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 11387 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11388 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11389 | |
| 11390 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 11391 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11392 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11393 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11394 | |
| 11395 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 11396 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11397 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11398 | {} |
| 11399 | }; |
| 11400 | |
| 11401 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11402 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11403 | #define alc262_loopbacks alc880_loopbacks |
| 11404 | #endif |
| 11405 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 11406 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11407 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 11408 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 11409 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 11410 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 11411 | |
| 11412 | /* |
| 11413 | * BIOS auto configuration |
| 11414 | */ |
| 11415 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 11416 | { |
| 11417 | struct alc_spec *spec = codec->spec; |
| 11418 | int err; |
| 11419 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 11420 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11421 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11422 | alc262_ignore); |
| 11423 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11424 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11425 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11426 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11427 | spec->multiout.max_channels = 2; |
| 11428 | spec->no_analog = 1; |
| 11429 | goto dig_only; |
| 11430 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11431 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11432 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11433 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11434 | if (err < 0) |
| 11435 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11436 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11437 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11438 | return err; |
| 11439 | |
| 11440 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11441 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11442 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11443 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11444 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11445 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11446 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11447 | if (spec->autocfg.dig_in_pin) |
| 11448 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 11449 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 11450 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11451 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11452 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11453 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11454 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11455 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11456 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11457 | err = alc_auto_add_mic_boost(codec); |
| 11458 | if (err < 0) |
| 11459 | return err; |
| 11460 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 11461 | alc_ssid_check(codec, 0x15, 0x14, 0x1b); |
| 11462 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11463 | return 1; |
| 11464 | } |
| 11465 | |
| 11466 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 11467 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 11468 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11469 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11470 | |
| 11471 | |
| 11472 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11473 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11474 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11475 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11476 | alc262_auto_init_multi_out(codec); |
| 11477 | alc262_auto_init_hp_out(codec); |
| 11478 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11479 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11480 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11481 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11482 | } |
| 11483 | |
| 11484 | /* |
| 11485 | * configuration and preset |
| 11486 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11487 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 11488 | [ALC262_BASIC] = "basic", |
| 11489 | [ALC262_HIPPO] = "hippo", |
| 11490 | [ALC262_HIPPO_1] = "hippo_1", |
| 11491 | [ALC262_FUJITSU] = "fujitsu", |
| 11492 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11493 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 11494 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11495 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11496 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 11497 | [ALC262_BENQ_T31] = "benq-t31", |
| 11498 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 11499 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11500 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11501 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11502 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11503 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11504 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11505 | [ALC262_AUTO] = "auto", |
| 11506 | }; |
| 11507 | |
| 11508 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 11509 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11510 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11511 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 11512 | ALC262_HP_BPC), |
| 11513 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 11514 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 11515 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 11516 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11517 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11518 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11519 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11520 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11521 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11522 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11523 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11524 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11525 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 11526 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 11527 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11528 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 11529 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11530 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11531 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11532 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11533 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 11534 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 11535 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 11536 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 11537 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 11538 | #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] | 11539 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 11540 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 11541 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 11542 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11543 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 11544 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11545 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 11546 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11547 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11548 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 11549 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 11550 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11551 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11552 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11553 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11554 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11555 | {} |
| 11556 | }; |
| 11557 | |
| 11558 | static struct alc_config_preset alc262_presets[] = { |
| 11559 | [ALC262_BASIC] = { |
| 11560 | .mixers = { alc262_base_mixer }, |
| 11561 | .init_verbs = { alc262_init_verbs }, |
| 11562 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11563 | .dac_nids = alc262_dac_nids, |
| 11564 | .hp_nid = 0x03, |
| 11565 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11566 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 11567 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11568 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11569 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11570 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 11571 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11572 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11573 | .dac_nids = alc262_dac_nids, |
| 11574 | .hp_nid = 0x03, |
| 11575 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11576 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11577 | .channel_mode = alc262_modes, |
| 11578 | .input_mux = &alc262_capture_source, |
| 11579 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11580 | .setup = alc262_hippo_setup, |
| 11581 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11582 | }, |
| 11583 | [ALC262_HIPPO_1] = { |
| 11584 | .mixers = { alc262_hippo1_mixer }, |
| 11585 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 11586 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11587 | .dac_nids = alc262_dac_nids, |
| 11588 | .hp_nid = 0x02, |
| 11589 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11590 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11591 | .channel_mode = alc262_modes, |
| 11592 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11593 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11594 | .setup = alc262_hippo1_setup, |
| 11595 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11596 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11597 | [ALC262_FUJITSU] = { |
| 11598 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11599 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11600 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11601 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11602 | .dac_nids = alc262_dac_nids, |
| 11603 | .hp_nid = 0x03, |
| 11604 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11605 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11606 | .channel_mode = alc262_modes, |
| 11607 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11608 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11609 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11610 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11611 | [ALC262_HP_BPC] = { |
| 11612 | .mixers = { alc262_HP_BPC_mixer }, |
| 11613 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 11614 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11615 | .dac_nids = alc262_dac_nids, |
| 11616 | .hp_nid = 0x03, |
| 11617 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11618 | .channel_mode = alc262_modes, |
| 11619 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11620 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 11621 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11622 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11623 | [ALC262_HP_BPC_D7000_WF] = { |
| 11624 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 11625 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11626 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11627 | .dac_nids = alc262_dac_nids, |
| 11628 | .hp_nid = 0x03, |
| 11629 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11630 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11631 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11632 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11633 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11634 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11635 | [ALC262_HP_BPC_D7000_WL] = { |
| 11636 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 11637 | alc262_HP_BPC_WildWest_option_mixer }, |
| 11638 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11639 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11640 | .dac_nids = alc262_dac_nids, |
| 11641 | .hp_nid = 0x03, |
| 11642 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11643 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11644 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11645 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11646 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11647 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11648 | [ALC262_HP_TC_T5735] = { |
| 11649 | .mixers = { alc262_hp_t5735_mixer }, |
| 11650 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 11651 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11652 | .dac_nids = alc262_dac_nids, |
| 11653 | .hp_nid = 0x03, |
| 11654 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11655 | .channel_mode = alc262_modes, |
| 11656 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11657 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11658 | .setup = alc262_hp_t5735_setup, |
| 11659 | .init_hook = alc_automute_amp, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11660 | }, |
| 11661 | [ALC262_HP_RP5700] = { |
| 11662 | .mixers = { alc262_hp_rp5700_mixer }, |
| 11663 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 11664 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11665 | .dac_nids = alc262_dac_nids, |
| 11666 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11667 | .channel_mode = alc262_modes, |
| 11668 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11669 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11670 | [ALC262_BENQ_ED8] = { |
| 11671 | .mixers = { alc262_base_mixer }, |
| 11672 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 11673 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11674 | .dac_nids = alc262_dac_nids, |
| 11675 | .hp_nid = 0x03, |
| 11676 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11677 | .channel_mode = alc262_modes, |
| 11678 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11679 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11680 | [ALC262_SONY_ASSAMD] = { |
| 11681 | .mixers = { alc262_sony_mixer }, |
| 11682 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 11683 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11684 | .dac_nids = alc262_dac_nids, |
| 11685 | .hp_nid = 0x02, |
| 11686 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11687 | .channel_mode = alc262_modes, |
| 11688 | .input_mux = &alc262_capture_source, |
| 11689 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11690 | .setup = alc262_hippo_setup, |
| 11691 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11692 | }, |
| 11693 | [ALC262_BENQ_T31] = { |
| 11694 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 11695 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 11696 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11697 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11698 | .dac_nids = alc262_dac_nids, |
| 11699 | .hp_nid = 0x03, |
| 11700 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11701 | .channel_mode = alc262_modes, |
| 11702 | .input_mux = &alc262_capture_source, |
| 11703 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11704 | .setup = alc262_hippo_setup, |
| 11705 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11706 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11707 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11708 | .mixers = { alc262_ultra_mixer }, |
| 11709 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11710 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11711 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11712 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11713 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11714 | .channel_mode = alc262_modes, |
| 11715 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11716 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 11717 | .capsrc_nids = alc262_capsrc_nids, |
| 11718 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11719 | .unsol_event = alc262_ultra_unsol_event, |
| 11720 | .init_hook = alc262_ultra_automute, |
| 11721 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11722 | [ALC262_LENOVO_3000] = { |
| 11723 | .mixers = { alc262_lenovo_3000_mixer }, |
| 11724 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11725 | alc262_lenovo_3000_unsol_verbs }, |
| 11726 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11727 | .dac_nids = alc262_dac_nids, |
| 11728 | .hp_nid = 0x03, |
| 11729 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11730 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11731 | .channel_mode = alc262_modes, |
| 11732 | .input_mux = &alc262_fujitsu_capture_source, |
| 11733 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 11734 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11735 | [ALC262_NEC] = { |
| 11736 | .mixers = { alc262_nec_mixer }, |
| 11737 | .init_verbs = { alc262_nec_verbs }, |
| 11738 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11739 | .dac_nids = alc262_dac_nids, |
| 11740 | .hp_nid = 0x03, |
| 11741 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11742 | .channel_mode = alc262_modes, |
| 11743 | .input_mux = &alc262_capture_source, |
| 11744 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11745 | [ALC262_TOSHIBA_S06] = { |
| 11746 | .mixers = { alc262_toshiba_s06_mixer }, |
| 11747 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 11748 | alc262_eapd_verbs }, |
| 11749 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11750 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 11751 | .dac_nids = alc262_dac_nids, |
| 11752 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 11753 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11754 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11755 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11756 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11757 | .unsol_event = alc_sku_unsol_event, |
| 11758 | .setup = alc262_toshiba_s06_setup, |
| 11759 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11760 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11761 | [ALC262_TOSHIBA_RX1] = { |
| 11762 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 11763 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 11764 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11765 | .dac_nids = alc262_dac_nids, |
| 11766 | .hp_nid = 0x03, |
| 11767 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11768 | .channel_mode = alc262_modes, |
| 11769 | .input_mux = &alc262_capture_source, |
| 11770 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11771 | .setup = alc262_hippo_setup, |
| 11772 | .init_hook = alc262_hippo_automute, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11773 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11774 | [ALC262_TYAN] = { |
| 11775 | .mixers = { alc262_tyan_mixer }, |
| 11776 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 11777 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11778 | .dac_nids = alc262_dac_nids, |
| 11779 | .hp_nid = 0x02, |
| 11780 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11781 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11782 | .channel_mode = alc262_modes, |
| 11783 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11784 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11785 | .setup = alc262_tyan_setup, |
| 11786 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11787 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11788 | }; |
| 11789 | |
| 11790 | static int patch_alc262(struct hda_codec *codec) |
| 11791 | { |
| 11792 | struct alc_spec *spec; |
| 11793 | int board_config; |
| 11794 | int err; |
| 11795 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11796 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11797 | if (spec == NULL) |
| 11798 | return -ENOMEM; |
| 11799 | |
| 11800 | codec->spec = spec; |
| 11801 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11802 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 11803 | * under-run |
| 11804 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11805 | { |
| 11806 | int tmp; |
| 11807 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11808 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 11809 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11810 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 11811 | } |
| 11812 | #endif |
| 11813 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11814 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11815 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11816 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 11817 | alc262_models, |
| 11818 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11819 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11820 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 11821 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 11822 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11823 | board_config = ALC262_AUTO; |
| 11824 | } |
| 11825 | |
| 11826 | if (board_config == ALC262_AUTO) { |
| 11827 | /* automatic parse from the BIOS config */ |
| 11828 | err = alc262_parse_auto_config(codec); |
| 11829 | if (err < 0) { |
| 11830 | alc_free(codec); |
| 11831 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11832 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11833 | printk(KERN_INFO |
| 11834 | "hda_codec: Cannot set up configuration " |
| 11835 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11836 | board_config = ALC262_BASIC; |
| 11837 | } |
| 11838 | } |
| 11839 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11840 | if (!spec->no_analog) { |
| 11841 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11842 | if (err < 0) { |
| 11843 | alc_free(codec); |
| 11844 | return err; |
| 11845 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11846 | } |
| 11847 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11848 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 11849 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11850 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11851 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 11852 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11853 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11854 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 11855 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 11856 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11857 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11858 | int i; |
| 11859 | /* check whether the digital-mic has to be supported */ |
| 11860 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 11861 | if (spec->input_mux->items[i].index >= 9) |
| 11862 | break; |
| 11863 | } |
| 11864 | if (i < spec->input_mux->num_items) { |
| 11865 | /* use only ADC0 */ |
| 11866 | spec->adc_nids = alc262_dmic_adc_nids; |
| 11867 | spec->num_adc_nids = 1; |
| 11868 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11869 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11870 | /* all analog inputs */ |
| 11871 | /* check whether NID 0x07 is valid */ |
| 11872 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 11873 | |
| 11874 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 11875 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11876 | if (wcap != AC_WID_AUD_IN) { |
| 11877 | spec->adc_nids = alc262_adc_nids_alt; |
| 11878 | spec->num_adc_nids = |
| 11879 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 11880 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 11881 | } else { |
| 11882 | spec->adc_nids = alc262_adc_nids; |
| 11883 | spec->num_adc_nids = |
| 11884 | ARRAY_SIZE(alc262_adc_nids); |
| 11885 | spec->capsrc_nids = alc262_capsrc_nids; |
| 11886 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11887 | } |
| 11888 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11889 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 11890 | set_capture_mixer(codec); |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11891 | if (!spec->no_analog) |
| 11892 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11893 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11894 | spec->vmaster_nid = 0x0c; |
| 11895 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11896 | codec->patch_ops = alc_patch_ops; |
| 11897 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11898 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11899 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11900 | if (!spec->loopback.amplist) |
| 11901 | spec->loopback.amplist = alc262_loopbacks; |
| 11902 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 11903 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11904 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11905 | return 0; |
| 11906 | } |
| 11907 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11908 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11909 | * ALC268 channel source setting (2 channel) |
| 11910 | */ |
| 11911 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 11912 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11913 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11914 | static hda_nid_t alc268_dac_nids[2] = { |
| 11915 | /* front, hp */ |
| 11916 | 0x02, 0x03 |
| 11917 | }; |
| 11918 | |
| 11919 | static hda_nid_t alc268_adc_nids[2] = { |
| 11920 | /* ADC0-1 */ |
| 11921 | 0x08, 0x07 |
| 11922 | }; |
| 11923 | |
| 11924 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 11925 | /* ADC0 */ |
| 11926 | 0x08 |
| 11927 | }; |
| 11928 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11929 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 11930 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11931 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 11932 | /* output mixer control */ |
| 11933 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11934 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11935 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11936 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11937 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11938 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11939 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11940 | { } |
| 11941 | }; |
| 11942 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11943 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 11944 | /* output mixer control */ |
| 11945 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11946 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11947 | ALC262_HIPPO_MASTER_SWITCH, |
| 11948 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11949 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11950 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11951 | { } |
| 11952 | }; |
| 11953 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11954 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 11955 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 11956 | .ops = &snd_hda_bind_sw, |
| 11957 | .values = { |
| 11958 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 11959 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 11960 | 0 |
| 11961 | }, |
| 11962 | }; |
| 11963 | |
| 11964 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 11965 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 11966 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 11967 | { } |
| 11968 | }; |
| 11969 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11970 | static struct hda_verb alc268_eapd_verbs[] = { |
| 11971 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11972 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11973 | { } |
| 11974 | }; |
| 11975 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11976 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11977 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 11978 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11979 | { } /* end */ |
| 11980 | }; |
| 11981 | |
| 11982 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11983 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 11984 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 11985 | .ops = &snd_hda_bind_vol, |
| 11986 | .values = { |
| 11987 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11988 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11989 | 0 |
| 11990 | }, |
| 11991 | }; |
| 11992 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11993 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11994 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 11995 | { |
| 11996 | struct alc_spec *spec = codec->spec; |
| 11997 | unsigned int mute; |
| 11998 | |
| 11999 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12000 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12001 | spec->sense_updated = 1; |
| 12002 | } |
| 12003 | if (spec->jack_present) |
| 12004 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 12005 | else /* unmute internal speaker if necessary */ |
| 12006 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 12007 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12008 | HDA_AMP_MUTE, mute); |
| 12009 | } |
| 12010 | |
| 12011 | |
| 12012 | /* bind hp and internal speaker mute (with plug check) */ |
| 12013 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 12014 | struct snd_ctl_elem_value *ucontrol) |
| 12015 | { |
| 12016 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12017 | long *valp = ucontrol->value.integer.value; |
| 12018 | int change; |
| 12019 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 12020 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12021 | if (change) |
| 12022 | alc268_acer_automute(codec, 0); |
| 12023 | return change; |
| 12024 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12025 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12026 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 12027 | /* output mixer control */ |
| 12028 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12029 | { |
| 12030 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12031 | .name = "Master Playback Switch", |
| 12032 | .info = snd_hda_mixer_amp_switch_info, |
| 12033 | .get = snd_hda_mixer_amp_switch_get, |
| 12034 | .put = alc268_acer_master_sw_put, |
| 12035 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12036 | }, |
| 12037 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 12038 | { } |
| 12039 | }; |
| 12040 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12041 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 12042 | /* output mixer control */ |
| 12043 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12044 | { |
| 12045 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12046 | .name = "Master Playback Switch", |
| 12047 | .info = snd_hda_mixer_amp_switch_info, |
| 12048 | .get = snd_hda_mixer_amp_switch_get, |
| 12049 | .put = alc268_acer_master_sw_put, |
| 12050 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12051 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12052 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12053 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12054 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12055 | { } |
| 12056 | }; |
| 12057 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12058 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 12059 | /* output mixer control */ |
| 12060 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12061 | { |
| 12062 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12063 | .name = "Master Playback Switch", |
| 12064 | .info = snd_hda_mixer_amp_switch_info, |
| 12065 | .get = snd_hda_mixer_amp_switch_get, |
| 12066 | .put = alc268_acer_master_sw_put, |
| 12067 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12068 | }, |
| 12069 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12070 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12071 | { } |
| 12072 | }; |
| 12073 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12074 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 12075 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12076 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12077 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12078 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12079 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 12080 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 12081 | { } |
| 12082 | }; |
| 12083 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12084 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12085 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 12086 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12087 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12088 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12089 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12090 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12091 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12092 | { } |
| 12093 | }; |
| 12094 | |
| 12095 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12096 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12097 | #define alc268_toshiba_setup alc262_hippo_setup |
| 12098 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12099 | |
| 12100 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 12101 | unsigned int res) |
| 12102 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12103 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12104 | return; |
| 12105 | alc268_acer_automute(codec, 1); |
| 12106 | } |
| 12107 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12108 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 12109 | { |
| 12110 | alc268_acer_automute(codec, 1); |
| 12111 | } |
| 12112 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12113 | /* toggle speaker-output according to the hp-jack state */ |
| 12114 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 12115 | { |
| 12116 | unsigned int present; |
| 12117 | unsigned char bits; |
| 12118 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12119 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12120 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12121 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 12122 | AMP_IN_MUTE(0), bits); |
| 12123 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 12124 | AMP_IN_MUTE(0), bits); |
| 12125 | } |
| 12126 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12127 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 12128 | unsigned int res) |
| 12129 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12130 | switch (res >> 26) { |
| 12131 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12132 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12133 | break; |
| 12134 | case ALC880_MIC_EVENT: |
| 12135 | alc_mic_automute(codec); |
| 12136 | break; |
| 12137 | } |
| 12138 | } |
| 12139 | |
| 12140 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 12141 | { |
| 12142 | struct alc_spec *spec = codec->spec; |
| 12143 | spec->ext_mic.pin = 0x18; |
| 12144 | spec->ext_mic.mux_idx = 0; |
| 12145 | spec->int_mic.pin = 0x12; |
| 12146 | spec->int_mic.mux_idx = 6; |
| 12147 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12148 | } |
| 12149 | |
| 12150 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 12151 | { |
| 12152 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12153 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12154 | } |
| 12155 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12156 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 12157 | /* output mixer control */ |
| 12158 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12159 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12160 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12161 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12162 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12163 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12164 | { } |
| 12165 | }; |
| 12166 | |
| 12167 | static struct hda_verb alc268_dell_verbs[] = { |
| 12168 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12169 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12170 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12171 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12172 | { } |
| 12173 | }; |
| 12174 | |
| 12175 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12176 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12177 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12178 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12179 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12180 | spec->autocfg.hp_pins[0] = 0x15; |
| 12181 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12182 | spec->ext_mic.pin = 0x18; |
| 12183 | spec->ext_mic.mux_idx = 0; |
| 12184 | spec->int_mic.pin = 0x19; |
| 12185 | spec->int_mic.mux_idx = 1; |
| 12186 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12187 | } |
| 12188 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12189 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 12190 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12191 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12192 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12193 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12194 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12195 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12196 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 12197 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 12198 | { } |
| 12199 | }; |
| 12200 | |
| 12201 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 12202 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12203 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 12204 | { } |
| 12205 | }; |
| 12206 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12207 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12208 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12209 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12210 | spec->autocfg.hp_pins[0] = 0x15; |
| 12211 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12212 | spec->ext_mic.pin = 0x18; |
| 12213 | spec->ext_mic.mux_idx = 0; |
| 12214 | spec->int_mic.pin = 0x19; |
| 12215 | spec->int_mic.mux_idx = 1; |
| 12216 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12217 | } |
| 12218 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12219 | /* |
| 12220 | * generic initialization of ADC, input mixers and output mixers |
| 12221 | */ |
| 12222 | static struct hda_verb alc268_base_init_verbs[] = { |
| 12223 | /* Unmute DAC0-1 and set vol = 0 */ |
| 12224 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12225 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12226 | |
| 12227 | /* |
| 12228 | * Set up output mixers (0x0c - 0x0e) |
| 12229 | */ |
| 12230 | /* set vol=0 to output mixers */ |
| 12231 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12232 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12233 | |
| 12234 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12235 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12236 | |
| 12237 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12238 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 12239 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12240 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12241 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12242 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12243 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12244 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12245 | |
| 12246 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12247 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12248 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12249 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12250 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12251 | |
| 12252 | /* set PCBEEP vol = 0, mute connections */ |
| 12253 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12254 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12255 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12256 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12257 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12258 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12259 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12260 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12261 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12262 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12263 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12264 | { } |
| 12265 | }; |
| 12266 | |
| 12267 | /* |
| 12268 | * generic initialization of ADC, input mixers and output mixers |
| 12269 | */ |
| 12270 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 12271 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 12272 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12273 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12274 | |
| 12275 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12276 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12277 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12278 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12279 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12280 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12281 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12282 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12283 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12284 | |
| 12285 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12286 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12287 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12288 | /* set PCBEEP vol = 0, mute connections */ |
| 12289 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12290 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12291 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12292 | |
| 12293 | { } |
| 12294 | }; |
| 12295 | |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12296 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 12297 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12298 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12299 | { } /* end */ |
| 12300 | }; |
| 12301 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12302 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 12303 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12304 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12305 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12306 | { } /* end */ |
| 12307 | }; |
| 12308 | |
| 12309 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 12310 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12311 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12312 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 12313 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12314 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12315 | { } /* end */ |
| 12316 | }; |
| 12317 | |
| 12318 | static struct hda_input_mux alc268_capture_source = { |
| 12319 | .num_items = 4, |
| 12320 | .items = { |
| 12321 | { "Mic", 0x0 }, |
| 12322 | { "Front Mic", 0x1 }, |
| 12323 | { "Line", 0x2 }, |
| 12324 | { "CD", 0x3 }, |
| 12325 | }, |
| 12326 | }; |
| 12327 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12328 | static struct hda_input_mux alc268_acer_capture_source = { |
| 12329 | .num_items = 3, |
| 12330 | .items = { |
| 12331 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12332 | { "Internal Mic", 0x1 }, |
| 12333 | { "Line", 0x2 }, |
| 12334 | }, |
| 12335 | }; |
| 12336 | |
| 12337 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 12338 | .num_items = 3, |
| 12339 | .items = { |
| 12340 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12341 | { "Internal Mic", 0x6 }, |
| 12342 | { "Line", 0x2 }, |
| 12343 | }, |
| 12344 | }; |
| 12345 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12346 | #ifdef CONFIG_SND_DEBUG |
| 12347 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12348 | /* Volume widgets */ |
| 12349 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12350 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12351 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 12352 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 12353 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 12354 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 12355 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 12356 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 12357 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 12358 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 12359 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 12360 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 12361 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 12362 | /* The below appears problematic on some hardwares */ |
| 12363 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12364 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12365 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12366 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 12367 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 12368 | |
| 12369 | /* Modes for retasking pin widgets */ |
| 12370 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 12371 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 12372 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 12373 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 12374 | |
| 12375 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 12376 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 12377 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 12378 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 12379 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 12380 | |
| 12381 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 12382 | * The ALC268 does not have an SPDIF input. |
| 12383 | */ |
| 12384 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 12385 | |
| 12386 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 12387 | * this output to turn on an external amplifier. |
| 12388 | */ |
| 12389 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 12390 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 12391 | |
| 12392 | { } /* end */ |
| 12393 | }; |
| 12394 | #endif |
| 12395 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12396 | /* create input playback/capture controls for the given pin */ |
| 12397 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 12398 | const char *ctlname, int idx) |
| 12399 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12400 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12401 | int err; |
| 12402 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12403 | switch (nid) { |
| 12404 | case 0x14: |
| 12405 | case 0x16: |
| 12406 | dac = 0x02; |
| 12407 | break; |
| 12408 | case 0x15: |
| 12409 | dac = 0x03; |
| 12410 | break; |
| 12411 | default: |
| 12412 | return 0; |
| 12413 | } |
| 12414 | if (spec->multiout.dac_nids[0] != dac && |
| 12415 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12416 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12417 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12418 | HDA_OUTPUT)); |
| 12419 | if (err < 0) |
| 12420 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12421 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 12422 | } |
| 12423 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12424 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12425 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12426 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12427 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12428 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12429 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12430 | if (err < 0) |
| 12431 | return err; |
| 12432 | return 0; |
| 12433 | } |
| 12434 | |
| 12435 | /* add playback controls from the parsed DAC table */ |
| 12436 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12437 | const struct auto_pin_cfg *cfg) |
| 12438 | { |
| 12439 | hda_nid_t nid; |
| 12440 | int err; |
| 12441 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12442 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12443 | |
| 12444 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12445 | if (nid) { |
| 12446 | const char *name; |
| 12447 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 12448 | name = "Speaker"; |
| 12449 | else |
| 12450 | name = "Front"; |
| 12451 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 12452 | if (err < 0) |
| 12453 | return err; |
| 12454 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12455 | |
| 12456 | nid = cfg->speaker_pins[0]; |
| 12457 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12458 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12459 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 12460 | if (err < 0) |
| 12461 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12462 | } else { |
| 12463 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 12464 | if (err < 0) |
| 12465 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12466 | } |
| 12467 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12468 | if (nid) { |
| 12469 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 12470 | if (err < 0) |
| 12471 | return err; |
| 12472 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12473 | |
| 12474 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 12475 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12476 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12477 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12478 | if (err < 0) |
| 12479 | return err; |
| 12480 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12481 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12482 | } |
| 12483 | |
| 12484 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12485 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12486 | const struct auto_pin_cfg *cfg) |
| 12487 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12488 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12489 | } |
| 12490 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 12491 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 12492 | hda_nid_t nid, int pin_type) |
| 12493 | { |
| 12494 | int idx; |
| 12495 | |
| 12496 | alc_set_pin_output(codec, nid, pin_type); |
| 12497 | if (nid == 0x14 || nid == 0x16) |
| 12498 | idx = 0; |
| 12499 | else |
| 12500 | idx = 1; |
| 12501 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 12502 | } |
| 12503 | |
| 12504 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 12505 | { |
| 12506 | struct alc_spec *spec = codec->spec; |
| 12507 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 12508 | if (nid) { |
| 12509 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 12510 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 12511 | } |
| 12512 | } |
| 12513 | |
| 12514 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 12515 | { |
| 12516 | struct alc_spec *spec = codec->spec; |
| 12517 | hda_nid_t pin; |
| 12518 | |
| 12519 | pin = spec->autocfg.hp_pins[0]; |
| 12520 | if (pin) |
| 12521 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 12522 | pin = spec->autocfg.speaker_pins[0]; |
| 12523 | if (pin) |
| 12524 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 12525 | } |
| 12526 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12527 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 12528 | { |
| 12529 | struct alc_spec *spec = codec->spec; |
| 12530 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 12531 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 12532 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 12533 | unsigned int dac_vol1, dac_vol2; |
| 12534 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 12535 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12536 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 12537 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 12538 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12539 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12540 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12541 | AMP_IN_UNMUTE(1)); |
| 12542 | snd_hda_codec_write(codec, 0x10, 0, |
| 12543 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12544 | AMP_IN_UNMUTE(1)); |
| 12545 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 12546 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12547 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12548 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12549 | snd_hda_codec_write(codec, 0x10, 0, |
| 12550 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12551 | } |
| 12552 | |
| 12553 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12554 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12555 | dac_vol2 = AMP_OUT_ZERO; |
| 12556 | else if (line_nid == 0x15) |
| 12557 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12558 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12559 | dac_vol2 = AMP_OUT_ZERO; |
| 12560 | else if (hp_nid == 0x15) |
| 12561 | dac_vol1 = AMP_OUT_ZERO; |
| 12562 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 12563 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 12564 | spec->autocfg.line_out_pins[2] != 0x16) |
| 12565 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 12566 | |
| 12567 | snd_hda_codec_write(codec, 0x02, 0, |
| 12568 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 12569 | snd_hda_codec_write(codec, 0x03, 0, |
| 12570 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 12571 | } |
| 12572 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12573 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12574 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 12575 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12576 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12577 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 12578 | |
| 12579 | /* |
| 12580 | * BIOS auto configuration |
| 12581 | */ |
| 12582 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 12583 | { |
| 12584 | struct alc_spec *spec = codec->spec; |
| 12585 | int err; |
| 12586 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 12587 | |
| 12588 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12589 | alc268_ignore); |
| 12590 | if (err < 0) |
| 12591 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12592 | if (!spec->autocfg.line_outs) { |
| 12593 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 12594 | spec->multiout.max_channels = 2; |
| 12595 | spec->no_analog = 1; |
| 12596 | goto dig_only; |
| 12597 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12598 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12599 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12600 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12601 | if (err < 0) |
| 12602 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12603 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12604 | if (err < 0) |
| 12605 | return err; |
| 12606 | |
| 12607 | spec->multiout.max_channels = 2; |
| 12608 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12609 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12610 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12611 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12612 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12613 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 12614 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12615 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12616 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12617 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 12618 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12619 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12620 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12621 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 12622 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12623 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12624 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12625 | err = alc_auto_add_mic_boost(codec); |
| 12626 | if (err < 0) |
| 12627 | return err; |
| 12628 | |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 12629 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 12630 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12631 | return 1; |
| 12632 | } |
| 12633 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12634 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 12635 | |
| 12636 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12637 | static void alc268_auto_init(struct hda_codec *codec) |
| 12638 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12639 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12640 | alc268_auto_init_multi_out(codec); |
| 12641 | alc268_auto_init_hp_out(codec); |
| 12642 | alc268_auto_init_mono_speaker_out(codec); |
| 12643 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12644 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12645 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12646 | } |
| 12647 | |
| 12648 | /* |
| 12649 | * configuration and preset |
| 12650 | */ |
| 12651 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12652 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12653 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12654 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12655 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12656 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12657 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12658 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12659 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12660 | #ifdef CONFIG_SND_DEBUG |
| 12661 | [ALC268_TEST] = "test", |
| 12662 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12663 | [ALC268_AUTO] = "auto", |
| 12664 | }; |
| 12665 | |
| 12666 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 12667 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12668 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 12669 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12670 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 12671 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12672 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 12673 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12674 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 12675 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 12676 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 12677 | /* almost compatible with toshiba but with optional digital outs; |
| 12678 | * auto-probing seems working fine |
| 12679 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12680 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 12681 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12682 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12683 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 12684 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 12685 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12686 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12687 | SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12688 | {} |
| 12689 | }; |
| 12690 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 12691 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 12692 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 12693 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 12694 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 12695 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 12696 | ALC268_TOSHIBA), |
| 12697 | {} |
| 12698 | }; |
| 12699 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12700 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12701 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12702 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 12703 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12704 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12705 | alc267_quanta_il1_verbs }, |
| 12706 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12707 | .dac_nids = alc268_dac_nids, |
| 12708 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12709 | .adc_nids = alc268_adc_nids_alt, |
| 12710 | .hp_nid = 0x03, |
| 12711 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12712 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12713 | .unsol_event = alc_sku_unsol_event, |
| 12714 | .setup = alc267_quanta_il1_setup, |
| 12715 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12716 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12717 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12718 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12719 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12720 | .init_verbs = { alc268_base_init_verbs }, |
| 12721 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12722 | .dac_nids = alc268_dac_nids, |
| 12723 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12724 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12725 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12726 | .hp_nid = 0x03, |
| 12727 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12728 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12729 | .channel_mode = alc268_modes, |
| 12730 | .input_mux = &alc268_capture_source, |
| 12731 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12732 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12733 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12734 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12735 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12736 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12737 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12738 | .dac_nids = alc268_dac_nids, |
| 12739 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12740 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12741 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12742 | .hp_nid = 0x03, |
| 12743 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12744 | .channel_mode = alc268_modes, |
| 12745 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12746 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12747 | .setup = alc268_toshiba_setup, |
| 12748 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12749 | }, |
| 12750 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 12751 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12752 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12753 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12754 | alc268_acer_verbs }, |
| 12755 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12756 | .dac_nids = alc268_dac_nids, |
| 12757 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12758 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12759 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12760 | .hp_nid = 0x02, |
| 12761 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12762 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12763 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12764 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12765 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12766 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12767 | [ALC268_ACER_DMIC] = { |
| 12768 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 12769 | alc268_beep_mixer }, |
| 12770 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12771 | alc268_acer_verbs }, |
| 12772 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12773 | .dac_nids = alc268_dac_nids, |
| 12774 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12775 | .adc_nids = alc268_adc_nids_alt, |
| 12776 | .capsrc_nids = alc268_capsrc_nids, |
| 12777 | .hp_nid = 0x02, |
| 12778 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12779 | .channel_mode = alc268_modes, |
| 12780 | .input_mux = &alc268_acer_dmic_capture_source, |
| 12781 | .unsol_event = alc268_acer_unsol_event, |
| 12782 | .init_hook = alc268_acer_init_hook, |
| 12783 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12784 | [ALC268_ACER_ASPIRE_ONE] = { |
| 12785 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12786 | alc268_beep_mixer, |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12787 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12788 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12789 | alc268_acer_aspire_one_verbs }, |
| 12790 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12791 | .dac_nids = alc268_dac_nids, |
| 12792 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12793 | .adc_nids = alc268_adc_nids_alt, |
| 12794 | .capsrc_nids = alc268_capsrc_nids, |
| 12795 | .hp_nid = 0x03, |
| 12796 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12797 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12798 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12799 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12800 | .init_hook = alc268_acer_lc_init_hook, |
| 12801 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12802 | [ALC268_DELL] = { |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12803 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 12804 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12805 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12806 | alc268_dell_verbs }, |
| 12807 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12808 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12809 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12810 | .adc_nids = alc268_adc_nids_alt, |
| 12811 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12812 | .hp_nid = 0x02, |
| 12813 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12814 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12815 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12816 | .setup = alc268_dell_setup, |
| 12817 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12818 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12819 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12820 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12821 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12822 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12823 | alc268_toshiba_verbs }, |
| 12824 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12825 | .dac_nids = alc268_dac_nids, |
| 12826 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12827 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12828 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12829 | .hp_nid = 0x03, |
| 12830 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12831 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12832 | .channel_mode = alc268_modes, |
| 12833 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12834 | .setup = alc268_toshiba_setup, |
| 12835 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12836 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12837 | #ifdef CONFIG_SND_DEBUG |
| 12838 | [ALC268_TEST] = { |
| 12839 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 12840 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12841 | alc268_volume_init_verbs }, |
| 12842 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12843 | .dac_nids = alc268_dac_nids, |
| 12844 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12845 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12846 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12847 | .hp_nid = 0x03, |
| 12848 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12849 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12850 | .channel_mode = alc268_modes, |
| 12851 | .input_mux = &alc268_capture_source, |
| 12852 | }, |
| 12853 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12854 | }; |
| 12855 | |
| 12856 | static int patch_alc268(struct hda_codec *codec) |
| 12857 | { |
| 12858 | struct alc_spec *spec; |
| 12859 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12860 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12861 | |
| 12862 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 12863 | if (spec == NULL) |
| 12864 | return -ENOMEM; |
| 12865 | |
| 12866 | codec->spec = spec; |
| 12867 | |
| 12868 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 12869 | alc268_models, |
| 12870 | alc268_cfg_tbl); |
| 12871 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 12872 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 12873 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 12874 | ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
| 12875 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12876 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12877 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12878 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12879 | board_config = ALC268_AUTO; |
| 12880 | } |
| 12881 | |
| 12882 | if (board_config == ALC268_AUTO) { |
| 12883 | /* automatic parse from the BIOS config */ |
| 12884 | err = alc268_parse_auto_config(codec); |
| 12885 | if (err < 0) { |
| 12886 | alc_free(codec); |
| 12887 | return err; |
| 12888 | } else if (!err) { |
| 12889 | printk(KERN_INFO |
| 12890 | "hda_codec: Cannot set up configuration " |
| 12891 | "from BIOS. Using base mode...\n"); |
| 12892 | board_config = ALC268_3ST; |
| 12893 | } |
| 12894 | } |
| 12895 | |
| 12896 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12897 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12898 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12899 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 12900 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12901 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12902 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12903 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 12904 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12905 | has_beep = 0; |
| 12906 | for (i = 0; i < spec->num_mixers; i++) { |
| 12907 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 12908 | has_beep = 1; |
| 12909 | break; |
| 12910 | } |
| 12911 | } |
| 12912 | |
| 12913 | if (has_beep) { |
| 12914 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12915 | if (err < 0) { |
| 12916 | alc_free(codec); |
| 12917 | return err; |
| 12918 | } |
| 12919 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 12920 | /* override the amp caps for beep generator */ |
| 12921 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12922 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 12923 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 12924 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 12925 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12926 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12927 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12928 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12929 | /* check whether NID 0x07 is valid */ |
| 12930 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12931 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12932 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 12933 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12934 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12935 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12936 | if (spec->auto_mic || |
| 12937 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12938 | spec->adc_nids = alc268_adc_nids_alt; |
| 12939 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 12940 | if (spec->auto_mic) |
| 12941 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12942 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 12943 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 12944 | else |
| 12945 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12946 | } else { |
| 12947 | spec->adc_nids = alc268_adc_nids; |
| 12948 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12949 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12950 | } |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12951 | /* set default input source */ |
| 12952 | for (i = 0; i < spec->num_adc_nids; i++) |
| 12953 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 12954 | 0, AC_VERB_SET_CONNECT_SEL, |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 12955 | i < spec->num_mux_defs ? |
| 12956 | spec->input_mux[i].items[0].index : |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12957 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12958 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12959 | |
| 12960 | spec->vmaster_nid = 0x02; |
| 12961 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12962 | codec->patch_ops = alc_patch_ops; |
| 12963 | if (board_config == ALC268_AUTO) |
| 12964 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12965 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 12966 | codec->proc_widget_hook = print_realtek_coef; |
| 12967 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12968 | return 0; |
| 12969 | } |
| 12970 | |
| 12971 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12972 | * ALC269 channel source setting (2 channel) |
| 12973 | */ |
| 12974 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 12975 | |
| 12976 | #define alc269_dac_nids alc260_dac_nids |
| 12977 | |
| 12978 | static hda_nid_t alc269_adc_nids[1] = { |
| 12979 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12980 | 0x08, |
| 12981 | }; |
| 12982 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12983 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 12984 | 0x23, |
| 12985 | }; |
| 12986 | |
| 12987 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 12988 | * not a mux! |
| 12989 | */ |
| 12990 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12991 | #define alc269_modes alc260_modes |
| 12992 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 12993 | |
| 12994 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 12995 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12996 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12997 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12998 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12999 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13000 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13001 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13002 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13003 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13004 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13005 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13006 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 13007 | { } /* end */ |
| 13008 | }; |
| 13009 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13010 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 13011 | /* output mixer control */ |
| 13012 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13013 | { |
| 13014 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13015 | .name = "Master Playback Switch", |
| 13016 | .info = snd_hda_mixer_amp_switch_info, |
| 13017 | .get = snd_hda_mixer_amp_switch_get, |
| 13018 | .put = alc268_acer_master_sw_put, |
| 13019 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13020 | }, |
| 13021 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13022 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13023 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13024 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13025 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13026 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13027 | { } |
| 13028 | }; |
| 13029 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13030 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 13031 | /* output mixer control */ |
| 13032 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13033 | { |
| 13034 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13035 | .name = "Master Playback Switch", |
| 13036 | .info = snd_hda_mixer_amp_switch_info, |
| 13037 | .get = snd_hda_mixer_amp_switch_get, |
| 13038 | .put = alc268_acer_master_sw_put, |
| 13039 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13040 | }, |
| 13041 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13042 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13043 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13044 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13045 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13046 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 13047 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 13048 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 13049 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13050 | { } |
| 13051 | }; |
| 13052 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13053 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13054 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13055 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13056 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13057 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13058 | { } /* end */ |
| 13059 | }; |
| 13060 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13061 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13062 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 13063 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13064 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13065 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13066 | { } /* end */ |
| 13067 | }; |
| 13068 | |
| 13069 | /* FSC amilo */ |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13070 | #define alc269_fujitsu_mixer alc269_eeepc_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13071 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13072 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 13073 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13074 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13075 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13076 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13077 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13078 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13079 | { } |
| 13080 | }; |
| 13081 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13082 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 13083 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13084 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13085 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13086 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13087 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13088 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13089 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13090 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13091 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13092 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13093 | { } |
| 13094 | }; |
| 13095 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13096 | /* toggle speaker-output according to the hp-jack state */ |
| 13097 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 13098 | { |
| 13099 | unsigned int present; |
| 13100 | unsigned char bits; |
| 13101 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13102 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13103 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 13104 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 13105 | AMP_IN_MUTE(0), bits); |
| 13106 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 13107 | AMP_IN_MUTE(0), bits); |
| 13108 | |
| 13109 | snd_hda_codec_write(codec, 0x20, 0, |
| 13110 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13111 | snd_hda_codec_write(codec, 0x20, 0, |
| 13112 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13113 | |
| 13114 | snd_hda_codec_write(codec, 0x20, 0, |
| 13115 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13116 | snd_hda_codec_write(codec, 0x20, 0, |
| 13117 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13118 | } |
| 13119 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13120 | /* toggle speaker-output according to the hp-jacks state */ |
| 13121 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 13122 | { |
| 13123 | unsigned int present; |
| 13124 | unsigned char bits; |
| 13125 | |
| 13126 | /* Check laptop headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13127 | present = snd_hda_jack_detect(codec, 0x15); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13128 | |
| 13129 | /* Check port replicator headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13130 | present |= snd_hda_jack_detect(codec, 0x1a); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13131 | |
| 13132 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 13133 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 13134 | AMP_IN_MUTE(0), bits); |
| 13135 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 13136 | AMP_IN_MUTE(0), bits); |
| 13137 | |
| 13138 | snd_hda_codec_write(codec, 0x20, 0, |
| 13139 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13140 | snd_hda_codec_write(codec, 0x20, 0, |
| 13141 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13142 | |
| 13143 | snd_hda_codec_write(codec, 0x20, 0, |
| 13144 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13145 | snd_hda_codec_write(codec, 0x20, 0, |
| 13146 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13147 | } |
| 13148 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13149 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 13150 | { |
| 13151 | unsigned int present_laptop; |
| 13152 | unsigned int present_dock; |
| 13153 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13154 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 13155 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13156 | |
| 13157 | /* Laptop mic port overrides dock mic port, design decision */ |
| 13158 | if (present_dock) |
| 13159 | snd_hda_codec_write(codec, 0x23, 0, |
| 13160 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 13161 | if (present_laptop) |
| 13162 | snd_hda_codec_write(codec, 0x23, 0, |
| 13163 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 13164 | if (!present_dock && !present_laptop) |
| 13165 | snd_hda_codec_write(codec, 0x23, 0, |
| 13166 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 13167 | } |
| 13168 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13169 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 13170 | unsigned int res) |
| 13171 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13172 | switch (res >> 26) { |
| 13173 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13174 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13175 | break; |
| 13176 | case ALC880_MIC_EVENT: |
| 13177 | alc_mic_automute(codec); |
| 13178 | break; |
| 13179 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13180 | } |
| 13181 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13182 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 13183 | unsigned int res) |
| 13184 | { |
| 13185 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13186 | alc269_lifebook_speaker_automute(codec); |
| 13187 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13188 | alc269_lifebook_mic_autoswitch(codec); |
| 13189 | } |
| 13190 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13191 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 13192 | { |
| 13193 | struct alc_spec *spec = codec->spec; |
| 13194 | spec->ext_mic.pin = 0x18; |
| 13195 | spec->ext_mic.mux_idx = 0; |
| 13196 | spec->int_mic.pin = 0x19; |
| 13197 | spec->int_mic.mux_idx = 1; |
| 13198 | spec->auto_mic = 1; |
| 13199 | } |
| 13200 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13201 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 13202 | { |
| 13203 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13204 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13205 | } |
| 13206 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13207 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 13208 | { |
| 13209 | alc269_lifebook_speaker_automute(codec); |
| 13210 | alc269_lifebook_mic_autoswitch(codec); |
| 13211 | } |
| 13212 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13213 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 13214 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13215 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 13216 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13217 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13218 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13219 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13220 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13221 | {} |
| 13222 | }; |
| 13223 | |
| 13224 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 13225 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13226 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13227 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13228 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 13229 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13230 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13231 | {} |
| 13232 | }; |
| 13233 | |
| 13234 | /* toggle speaker-output according to the hp-jack state */ |
| 13235 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 13236 | { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13237 | struct alc_spec *spec = codec->spec; |
| 13238 | unsigned int nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13239 | unsigned int present; |
| 13240 | unsigned char bits; |
| 13241 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13242 | present = snd_hda_jack_detect(codec, nid); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13243 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 13244 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 13245 | AMP_IN_MUTE(0), bits); |
| 13246 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 13247 | AMP_IN_MUTE(0), bits); |
| 13248 | } |
| 13249 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13250 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13251 | static void alc269_eeepc_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13252 | unsigned int res) |
| 13253 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13254 | switch (res >> 26) { |
| 13255 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13256 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13257 | break; |
| 13258 | case ALC880_MIC_EVENT: |
| 13259 | alc_mic_automute(codec); |
| 13260 | break; |
| 13261 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13262 | } |
| 13263 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13264 | static void alc269_eeepc_dmic_setup(struct hda_codec *codec) |
| 13265 | { |
| 13266 | struct alc_spec *spec = codec->spec; |
| 13267 | spec->ext_mic.pin = 0x18; |
| 13268 | spec->ext_mic.mux_idx = 0; |
| 13269 | spec->int_mic.pin = 0x12; |
| 13270 | spec->int_mic.mux_idx = 5; |
| 13271 | spec->auto_mic = 1; |
| 13272 | } |
| 13273 | |
| 13274 | static void alc269_eeepc_amic_setup(struct hda_codec *codec) |
| 13275 | { |
| 13276 | struct alc_spec *spec = codec->spec; |
| 13277 | spec->ext_mic.pin = 0x18; |
| 13278 | spec->ext_mic.mux_idx = 0; |
| 13279 | spec->int_mic.pin = 0x19; |
| 13280 | spec->int_mic.mux_idx = 1; |
| 13281 | spec->auto_mic = 1; |
| 13282 | } |
| 13283 | |
| 13284 | static void alc269_eeepc_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13285 | { |
| 13286 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13287 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13288 | } |
| 13289 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13290 | /* |
| 13291 | * generic initialization of ADC, input mixers and output mixers |
| 13292 | */ |
| 13293 | static struct hda_verb alc269_init_verbs[] = { |
| 13294 | /* |
| 13295 | * Unmute ADC0 and set the default input to mic-in |
| 13296 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13297 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13298 | |
| 13299 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 13300 | * analog-loopback mixer widget |
| 13301 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 13302 | * front panel mic (mic 2) |
| 13303 | */ |
| 13304 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 13305 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13306 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13307 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13308 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13309 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 13310 | |
| 13311 | /* |
| 13312 | * Set up output mixers (0x0c - 0x0e) |
| 13313 | */ |
| 13314 | /* set vol=0 to output mixers */ |
| 13315 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13316 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13317 | |
| 13318 | /* set up input amps for analog loopback */ |
| 13319 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 13320 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13321 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13322 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13323 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13324 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13325 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13326 | |
| 13327 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13328 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13329 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13330 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13331 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13332 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13333 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13334 | |
| 13335 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13336 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13337 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13338 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13339 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13340 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13341 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13342 | |
| 13343 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13344 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13345 | |
| 13346 | /* FIXME: use matrix-type input source selection */ |
| 13347 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 13348 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13349 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13350 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13351 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13352 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13353 | |
| 13354 | /* set EAPD */ |
| 13355 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13356 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13357 | { } |
| 13358 | }; |
| 13359 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 13360 | #define alc269_auto_create_multi_out_ctls \ |
| 13361 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13362 | #define alc269_auto_create_input_ctls \ |
| 13363 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13364 | |
| 13365 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13366 | #define alc269_loopbacks alc880_loopbacks |
| 13367 | #endif |
| 13368 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13369 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13370 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 13371 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 13372 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 13373 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 13374 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13375 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 13376 | .substreams = 1, |
| 13377 | .channels_min = 2, |
| 13378 | .channels_max = 8, |
| 13379 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13380 | /* NID is set in alc_build_pcms */ |
| 13381 | .ops = { |
| 13382 | .open = alc880_playback_pcm_open, |
| 13383 | .prepare = alc880_playback_pcm_prepare, |
| 13384 | .cleanup = alc880_playback_pcm_cleanup |
| 13385 | }, |
| 13386 | }; |
| 13387 | |
| 13388 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 13389 | .substreams = 1, |
| 13390 | .channels_min = 2, |
| 13391 | .channels_max = 2, |
| 13392 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13393 | /* NID is set in alc_build_pcms */ |
| 13394 | }; |
| 13395 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13396 | /* |
| 13397 | * BIOS auto configuration |
| 13398 | */ |
| 13399 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 13400 | { |
| 13401 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 13402 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13403 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 13404 | |
| 13405 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13406 | alc269_ignore); |
| 13407 | if (err < 0) |
| 13408 | return err; |
| 13409 | |
| 13410 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13411 | if (err < 0) |
| 13412 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13413 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13414 | if (err < 0) |
| 13415 | return err; |
| 13416 | |
| 13417 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13418 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 13419 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13420 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 13421 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13422 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13423 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13424 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13425 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13426 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13427 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13428 | /* set default input source */ |
| 13429 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 13430 | 0, AC_VERB_SET_CONNECT_SEL, |
| 13431 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13432 | |
| 13433 | err = alc_auto_add_mic_boost(codec); |
| 13434 | if (err < 0) |
| 13435 | return err; |
| 13436 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13437 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 13438 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13439 | |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13440 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 13441 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13442 | return 1; |
| 13443 | } |
| 13444 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13445 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 13446 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13447 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 13448 | |
| 13449 | |
| 13450 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13451 | static void alc269_auto_init(struct hda_codec *codec) |
| 13452 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13453 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13454 | alc269_auto_init_multi_out(codec); |
| 13455 | alc269_auto_init_hp_out(codec); |
| 13456 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13457 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13458 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13459 | } |
| 13460 | |
| 13461 | /* |
| 13462 | * configuration and preset |
| 13463 | */ |
| 13464 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13465 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 13466 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13467 | [ALC269_ASUS_AMIC] = "asus-amic", |
| 13468 | [ALC269_ASUS_DMIC] = "asus-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13469 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 13470 | [ALC269_LIFEBOOK] = "lifebook", |
| 13471 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13472 | }; |
| 13473 | |
| 13474 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13475 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13476 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13477 | ALC269_ASUS_AMIC), |
| 13478 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_ASUS_AMIC), |
| 13479 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80JT", ALC269_ASUS_AMIC), |
| 13480 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_ASUS_AMIC), |
| 13481 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_ASUS_AMIC), |
| 13482 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_ASUS_AMIC), |
| 13483 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_ASUS_AMIC), |
| 13484 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_ASUS_AMIC), |
| 13485 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_ASUS_AMIC), |
| 13486 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_ASUS_AMIC), |
| 13487 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_ASUS_AMIC), |
| 13488 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_ASUS_AMIC), |
| 13489 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_ASUS_AMIC), |
| 13490 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_ASUS_AMIC), |
| 13491 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_ASUS_AMIC), |
| 13492 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_ASUS_AMIC), |
| 13493 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_ASUS_AMIC), |
| 13494 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_ASUS_AMIC), |
| 13495 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_ASUS_AMIC), |
| 13496 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_ASUS_AMIC), |
| 13497 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_ASUS_AMIC), |
| 13498 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_AMIC), |
| 13499 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_ASUS_AMIC), |
| 13500 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_AMIC), |
| 13501 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_DMIC), |
| 13502 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_AMIC), |
| 13503 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_AMIC), |
| 13504 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_AMIC), |
| 13505 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13506 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13507 | ALC269_ASUS_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13508 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13509 | ALC269_ASUS_DMIC), |
| 13510 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_ASUS_DMIC), |
| 13511 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_ASUS_DMIC), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13512 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13513 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13514 | {} |
| 13515 | }; |
| 13516 | |
| 13517 | static struct alc_config_preset alc269_presets[] = { |
| 13518 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13519 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13520 | .init_verbs = { alc269_init_verbs }, |
| 13521 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13522 | .dac_nids = alc269_dac_nids, |
| 13523 | .hp_nid = 0x03, |
| 13524 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13525 | .channel_mode = alc269_modes, |
| 13526 | .input_mux = &alc269_capture_source, |
| 13527 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13528 | [ALC269_QUANTA_FL1] = { |
| 13529 | .mixers = { alc269_quanta_fl1_mixer }, |
| 13530 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 13531 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13532 | .dac_nids = alc269_dac_nids, |
| 13533 | .hp_nid = 0x03, |
| 13534 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13535 | .channel_mode = alc269_modes, |
| 13536 | .input_mux = &alc269_capture_source, |
| 13537 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13538 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13539 | .init_hook = alc269_quanta_fl1_init_hook, |
| 13540 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13541 | [ALC269_ASUS_AMIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13542 | .mixers = { alc269_eeepc_mixer }, |
| 13543 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13544 | .init_verbs = { alc269_init_verbs, |
| 13545 | alc269_eeepc_amic_init_verbs }, |
| 13546 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13547 | .dac_nids = alc269_dac_nids, |
| 13548 | .hp_nid = 0x03, |
| 13549 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13550 | .channel_mode = alc269_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13551 | .unsol_event = alc269_eeepc_unsol_event, |
| 13552 | .setup = alc269_eeepc_amic_setup, |
| 13553 | .init_hook = alc269_eeepc_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13554 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13555 | [ALC269_ASUS_DMIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13556 | .mixers = { alc269_eeepc_mixer }, |
| 13557 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13558 | .init_verbs = { alc269_init_verbs, |
| 13559 | alc269_eeepc_dmic_init_verbs }, |
| 13560 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13561 | .dac_nids = alc269_dac_nids, |
| 13562 | .hp_nid = 0x03, |
| 13563 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13564 | .channel_mode = alc269_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13565 | .unsol_event = alc269_eeepc_unsol_event, |
| 13566 | .setup = alc269_eeepc_dmic_setup, |
| 13567 | .init_hook = alc269_eeepc_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13568 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13569 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13570 | .mixers = { alc269_fujitsu_mixer }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13571 | .cap_mixer = alc269_epc_capture_mixer, |
| 13572 | .init_verbs = { alc269_init_verbs, |
| 13573 | alc269_eeepc_dmic_init_verbs }, |
| 13574 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13575 | .dac_nids = alc269_dac_nids, |
| 13576 | .hp_nid = 0x03, |
| 13577 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13578 | .channel_mode = alc269_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13579 | .unsol_event = alc269_eeepc_unsol_event, |
| 13580 | .setup = alc269_eeepc_dmic_setup, |
| 13581 | .init_hook = alc269_eeepc_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13582 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13583 | [ALC269_LIFEBOOK] = { |
| 13584 | .mixers = { alc269_lifebook_mixer }, |
| 13585 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 13586 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13587 | .dac_nids = alc269_dac_nids, |
| 13588 | .hp_nid = 0x03, |
| 13589 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13590 | .channel_mode = alc269_modes, |
| 13591 | .input_mux = &alc269_capture_source, |
| 13592 | .unsol_event = alc269_lifebook_unsol_event, |
| 13593 | .init_hook = alc269_lifebook_init_hook, |
| 13594 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13595 | }; |
| 13596 | |
| 13597 | static int patch_alc269(struct hda_codec *codec) |
| 13598 | { |
| 13599 | struct alc_spec *spec; |
| 13600 | int board_config; |
| 13601 | int err; |
| 13602 | |
| 13603 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13604 | if (spec == NULL) |
| 13605 | return -ENOMEM; |
| 13606 | |
| 13607 | codec->spec = spec; |
| 13608 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 13609 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 13610 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 13611 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ |
| 13612 | kfree(codec->chip_name); |
| 13613 | codec->chip_name = kstrdup("ALC259", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 13614 | if (!codec->chip_name) { |
| 13615 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 13616 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 13617 | } |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 13618 | } |
| 13619 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13620 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 13621 | alc269_models, |
| 13622 | alc269_cfg_tbl); |
| 13623 | |
| 13624 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13625 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13626 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13627 | board_config = ALC269_AUTO; |
| 13628 | } |
| 13629 | |
| 13630 | if (board_config == ALC269_AUTO) { |
| 13631 | /* automatic parse from the BIOS config */ |
| 13632 | err = alc269_parse_auto_config(codec); |
| 13633 | if (err < 0) { |
| 13634 | alc_free(codec); |
| 13635 | return err; |
| 13636 | } else if (!err) { |
| 13637 | printk(KERN_INFO |
| 13638 | "hda_codec: Cannot set up configuration " |
| 13639 | "from BIOS. Using base mode...\n"); |
| 13640 | board_config = ALC269_BASIC; |
| 13641 | } |
| 13642 | } |
| 13643 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 13644 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13645 | if (err < 0) { |
| 13646 | alc_free(codec); |
| 13647 | return err; |
| 13648 | } |
| 13649 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13650 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 13651 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13652 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13653 | if (codec->subsystem_id == 0x17aa3bf8) { |
| 13654 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 13655 | * fix the sample rate of analog I/O to 44.1kHz |
| 13656 | */ |
| 13657 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 13658 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
| 13659 | } else { |
| 13660 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 13661 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 13662 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13663 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 13664 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 13665 | |
| 13666 | spec->adc_nids = alc269_adc_nids; |
| 13667 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13668 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13669 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 13670 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13671 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13672 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 13673 | spec->vmaster_nid = 0x02; |
| 13674 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13675 | codec->patch_ops = alc_patch_ops; |
| 13676 | if (board_config == ALC269_AUTO) |
| 13677 | spec->init_hook = alc269_auto_init; |
| 13678 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13679 | if (!spec->loopback.amplist) |
| 13680 | spec->loopback.amplist = alc269_loopbacks; |
| 13681 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 13682 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13683 | |
| 13684 | return 0; |
| 13685 | } |
| 13686 | |
| 13687 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13688 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 13689 | */ |
| 13690 | |
| 13691 | /* |
| 13692 | * set the path ways for 2 channel output |
| 13693 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 13694 | */ |
| 13695 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 13696 | /* set pin widget 1Ah (line in) for input */ |
| 13697 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13698 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13699 | * the vref |
| 13700 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13701 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13702 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13703 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13704 | #if 0 |
| 13705 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13706 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13707 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13708 | { } /* end */ |
| 13709 | }; |
| 13710 | /* |
| 13711 | * 6ch mode |
| 13712 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 13713 | */ |
| 13714 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 13715 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13716 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13717 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13718 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13719 | |
| 13720 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13721 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13722 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13723 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13724 | #if 0 |
| 13725 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13726 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13727 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13728 | { } /* end */ |
| 13729 | }; |
| 13730 | |
| 13731 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 13732 | { 2, alc861_threestack_ch2_init }, |
| 13733 | { 6, alc861_threestack_ch6_init }, |
| 13734 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13735 | /* Set mic1 as input and unmute the mixer */ |
| 13736 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 13737 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13738 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13739 | { } /* end */ |
| 13740 | }; |
| 13741 | /* Set mic1 as output and mute mixer */ |
| 13742 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 13743 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13744 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13745 | { } /* end */ |
| 13746 | }; |
| 13747 | |
| 13748 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 13749 | { 2, alc861_uniwill_m31_ch2_init }, |
| 13750 | { 4, alc861_uniwill_m31_ch4_init }, |
| 13751 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13752 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13753 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 13754 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 13755 | /* set pin widget 1Ah (line in) for input */ |
| 13756 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13757 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13758 | * the vref |
| 13759 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13760 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13761 | |
| 13762 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13763 | #if 0 |
| 13764 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13765 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13766 | #endif |
| 13767 | { } /* end */ |
| 13768 | }; |
| 13769 | /* Set mic1 nad line-in as output and mute mixer */ |
| 13770 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 13771 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13772 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13773 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13774 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13775 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13776 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13777 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13778 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13779 | |
| 13780 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13781 | #if 0 |
| 13782 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13783 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13784 | #endif |
| 13785 | { } /* end */ |
| 13786 | }; |
| 13787 | |
| 13788 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 13789 | { 2, alc861_asus_ch2_init }, |
| 13790 | { 6, alc861_asus_ch6_init }, |
| 13791 | }; |
| 13792 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13793 | /* patch-ALC861 */ |
| 13794 | |
| 13795 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 13796 | /* output mixer control */ |
| 13797 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13798 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13799 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13800 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13801 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13802 | |
| 13803 | /*Input mixer control */ |
| 13804 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13805 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13806 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13807 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13808 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13809 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13810 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13811 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13812 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13813 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13814 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13815 | { } /* end */ |
| 13816 | }; |
| 13817 | |
| 13818 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 13819 | /* output mixer control */ |
| 13820 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13821 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13822 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13823 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13824 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13825 | |
| 13826 | /* Input mixer control */ |
| 13827 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13828 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13829 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13830 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13831 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13832 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13833 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13834 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13835 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13836 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13837 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13838 | { |
| 13839 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13840 | .name = "Channel Mode", |
| 13841 | .info = alc_ch_mode_info, |
| 13842 | .get = alc_ch_mode_get, |
| 13843 | .put = alc_ch_mode_put, |
| 13844 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 13845 | }, |
| 13846 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13847 | }; |
| 13848 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13849 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13850 | /* output mixer control */ |
| 13851 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13852 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13853 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13854 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13855 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13856 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13857 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13858 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 13859 | /* output mixer control */ |
| 13860 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13861 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13862 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13863 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13864 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13865 | |
| 13866 | /* Input mixer control */ |
| 13867 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13868 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13869 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13870 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13871 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13872 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13873 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13874 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13875 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13876 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13877 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13878 | { |
| 13879 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13880 | .name = "Channel Mode", |
| 13881 | .info = alc_ch_mode_info, |
| 13882 | .get = alc_ch_mode_get, |
| 13883 | .put = alc_ch_mode_put, |
| 13884 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13885 | }, |
| 13886 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13887 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13888 | |
| 13889 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 13890 | /* output mixer control */ |
| 13891 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13892 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13893 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13894 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13895 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13896 | |
| 13897 | /* Input mixer control */ |
| 13898 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13899 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13900 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13901 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13902 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13903 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13904 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13905 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13906 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13907 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 13908 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13909 | { |
| 13910 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13911 | .name = "Channel Mode", |
| 13912 | .info = alc_ch_mode_info, |
| 13913 | .get = alc_ch_mode_get, |
| 13914 | .put = alc_ch_mode_put, |
| 13915 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 13916 | }, |
| 13917 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13918 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13919 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13920 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13921 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13922 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13923 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13924 | { } |
| 13925 | }; |
| 13926 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13927 | /* |
| 13928 | * generic initialization of ADC, input mixers and output mixers |
| 13929 | */ |
| 13930 | static struct hda_verb alc861_base_init_verbs[] = { |
| 13931 | /* |
| 13932 | * Unmute ADC0 and set the default input to mic-in |
| 13933 | */ |
| 13934 | /* port-A for surround (rear panel) */ |
| 13935 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13936 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13937 | /* port-B for mic-in (rear panel) with vref */ |
| 13938 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13939 | /* port-C for line-in (rear panel) */ |
| 13940 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13941 | /* port-D for Front */ |
| 13942 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13943 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13944 | /* port-E for HP out (front panel) */ |
| 13945 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13946 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13947 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13948 | /* port-F for mic-in (front panel) with vref */ |
| 13949 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13950 | /* port-G for CLFE (rear panel) */ |
| 13951 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13952 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13953 | /* port-H for side (rear panel) */ |
| 13954 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13955 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13956 | /* CD-in */ |
| 13957 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13958 | /* route front mic to ADC1*/ |
| 13959 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13960 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13961 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13962 | /* Unmute DAC0~3 & spdif out*/ |
| 13963 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13964 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13965 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13966 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13967 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13968 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13969 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13970 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13971 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13972 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13973 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13974 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13975 | /* Unmute Stereo Mixer 15 */ |
| 13976 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13977 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13978 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13979 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13980 | |
| 13981 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13982 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13983 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13984 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13985 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13986 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13987 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13988 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13989 | /* hp used DAC 3 (Front) */ |
| 13990 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13991 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13992 | |
| 13993 | { } |
| 13994 | }; |
| 13995 | |
| 13996 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 13997 | /* |
| 13998 | * Unmute ADC0 and set the default input to mic-in |
| 13999 | */ |
| 14000 | /* port-A for surround (rear panel) */ |
| 14001 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14002 | /* port-B for mic-in (rear panel) with vref */ |
| 14003 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14004 | /* port-C for line-in (rear panel) */ |
| 14005 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14006 | /* port-D for Front */ |
| 14007 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14008 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14009 | /* port-E for HP out (front panel) */ |
| 14010 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 14011 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14012 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14013 | /* port-F for mic-in (front panel) with vref */ |
| 14014 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14015 | /* port-G for CLFE (rear panel) */ |
| 14016 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14017 | /* port-H for side (rear panel) */ |
| 14018 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14019 | /* CD-in */ |
| 14020 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14021 | /* route front mic to ADC1*/ |
| 14022 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14023 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14024 | /* Unmute DAC0~3 & spdif out*/ |
| 14025 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14026 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14027 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14028 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14029 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14030 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14031 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14032 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14033 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14034 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14035 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14036 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14037 | /* Unmute Stereo Mixer 15 */ |
| 14038 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14039 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14040 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14041 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14042 | |
| 14043 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14044 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14045 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14046 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14047 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14048 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14049 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14050 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14051 | /* hp used DAC 3 (Front) */ |
| 14052 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14053 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14054 | { } |
| 14055 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14056 | |
| 14057 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 14058 | /* |
| 14059 | * Unmute ADC0 and set the default input to mic-in |
| 14060 | */ |
| 14061 | /* port-A for surround (rear panel) */ |
| 14062 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14063 | /* port-B for mic-in (rear panel) with vref */ |
| 14064 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14065 | /* port-C for line-in (rear panel) */ |
| 14066 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14067 | /* port-D for Front */ |
| 14068 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14069 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14070 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14071 | /* this has to be set to VREF80 */ |
| 14072 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14073 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14074 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14075 | /* port-F for mic-in (front panel) with vref */ |
| 14076 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14077 | /* port-G for CLFE (rear panel) */ |
| 14078 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14079 | /* port-H for side (rear panel) */ |
| 14080 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14081 | /* CD-in */ |
| 14082 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14083 | /* route front mic to ADC1*/ |
| 14084 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14085 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14086 | /* Unmute DAC0~3 & spdif out*/ |
| 14087 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14088 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14089 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14090 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14091 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14092 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14093 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14094 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14095 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14096 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14097 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14098 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14099 | /* Unmute Stereo Mixer 15 */ |
| 14100 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14101 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14102 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14103 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14104 | |
| 14105 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14106 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14107 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14108 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14109 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14110 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14111 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14112 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14113 | /* hp used DAC 3 (Front) */ |
| 14114 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14115 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14116 | { } |
| 14117 | }; |
| 14118 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14119 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 14120 | /* |
| 14121 | * Unmute ADC0 and set the default input to mic-in |
| 14122 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14123 | /* port-A for surround (rear panel) |
| 14124 | * according to codec#0 this is the HP jack |
| 14125 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14126 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 14127 | /* route front PCM to HP */ |
| 14128 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 14129 | /* port-B for mic-in (rear panel) with vref */ |
| 14130 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14131 | /* port-C for line-in (rear panel) */ |
| 14132 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14133 | /* port-D for Front */ |
| 14134 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14135 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14136 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14137 | /* this has to be set to VREF80 */ |
| 14138 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14139 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14140 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14141 | /* port-F for mic-in (front panel) with vref */ |
| 14142 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14143 | /* port-G for CLFE (rear panel) */ |
| 14144 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14145 | /* port-H for side (rear panel) */ |
| 14146 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14147 | /* CD-in */ |
| 14148 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14149 | /* route front mic to ADC1*/ |
| 14150 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14151 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14152 | /* Unmute DAC0~3 & spdif out*/ |
| 14153 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14154 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14155 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14156 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14157 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14158 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14159 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14160 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14161 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14162 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14163 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14164 | /* Unmute Stereo Mixer 15 */ |
| 14165 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14166 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14167 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14168 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14169 | |
| 14170 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14171 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14172 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14173 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14174 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14175 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14176 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14177 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14178 | /* hp used DAC 3 (Front) */ |
| 14179 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14180 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14181 | { } |
| 14182 | }; |
| 14183 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14184 | /* additional init verbs for ASUS laptops */ |
| 14185 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 14186 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 14187 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 14188 | { } |
| 14189 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14190 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14191 | /* |
| 14192 | * generic initialization of ADC, input mixers and output mixers |
| 14193 | */ |
| 14194 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 14195 | /* |
| 14196 | * Unmute ADC0 and set the default input to mic-in |
| 14197 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14198 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14199 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14200 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14201 | /* Unmute DAC0~3 & spdif out*/ |
| 14202 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14203 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14204 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14205 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14206 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14207 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14208 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14209 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14210 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14211 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14212 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14213 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14214 | /* Unmute Stereo Mixer 15 */ |
| 14215 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14216 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14217 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14218 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 14219 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14220 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14221 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14222 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14223 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14224 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14225 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14226 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14227 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14228 | |
| 14229 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14230 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14231 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14232 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14233 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14234 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14235 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14236 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14237 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14238 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14239 | |
| 14240 | { } |
| 14241 | }; |
| 14242 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14243 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 14244 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14245 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14246 | { } |
| 14247 | }; |
| 14248 | |
| 14249 | /* toggle speaker-output according to the hp-jack state */ |
| 14250 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 14251 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14252 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14253 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14254 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 14255 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 14256 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 14257 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14258 | } |
| 14259 | |
| 14260 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 14261 | unsigned int res) |
| 14262 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14263 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14264 | alc861_toshiba_automute(codec); |
| 14265 | } |
| 14266 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14267 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14268 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 14269 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 14270 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 14271 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 14272 | |
| 14273 | |
| 14274 | #define ALC861_DIGOUT_NID 0x07 |
| 14275 | |
| 14276 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 14277 | { 8, NULL } |
| 14278 | }; |
| 14279 | |
| 14280 | static hda_nid_t alc861_dac_nids[4] = { |
| 14281 | /* front, surround, clfe, side */ |
| 14282 | 0x03, 0x06, 0x05, 0x04 |
| 14283 | }; |
| 14284 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14285 | static hda_nid_t alc660_dac_nids[3] = { |
| 14286 | /* front, clfe, surround */ |
| 14287 | 0x03, 0x05, 0x06 |
| 14288 | }; |
| 14289 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14290 | static hda_nid_t alc861_adc_nids[1] = { |
| 14291 | /* ADC0-2 */ |
| 14292 | 0x08, |
| 14293 | }; |
| 14294 | |
| 14295 | static struct hda_input_mux alc861_capture_source = { |
| 14296 | .num_items = 5, |
| 14297 | .items = { |
| 14298 | { "Mic", 0x0 }, |
| 14299 | { "Front Mic", 0x3 }, |
| 14300 | { "Line", 0x1 }, |
| 14301 | { "CD", 0x4 }, |
| 14302 | { "Mixer", 0x5 }, |
| 14303 | }, |
| 14304 | }; |
| 14305 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14306 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 14307 | { |
| 14308 | struct alc_spec *spec = codec->spec; |
| 14309 | hda_nid_t mix, srcs[5]; |
| 14310 | int i, j, num; |
| 14311 | |
| 14312 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 14313 | return 0; |
| 14314 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 14315 | if (num < 0) |
| 14316 | return 0; |
| 14317 | for (i = 0; i < num; i++) { |
| 14318 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 14319 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14320 | if (type != AC_WID_AUD_OUT) |
| 14321 | continue; |
| 14322 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 14323 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 14324 | break; |
| 14325 | if (j >= spec->multiout.num_dacs) |
| 14326 | return srcs[i]; |
| 14327 | } |
| 14328 | return 0; |
| 14329 | } |
| 14330 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14331 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14332 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14333 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14334 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14335 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14336 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14337 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14338 | |
| 14339 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 14340 | for (i = 0; i < cfg->line_outs; i++) { |
| 14341 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14342 | dac = alc861_look_for_dac(codec, nid); |
| 14343 | if (!dac) |
| 14344 | continue; |
| 14345 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14346 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14347 | return 0; |
| 14348 | } |
| 14349 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14350 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 14351 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14352 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 14353 | return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14354 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 14355 | } |
| 14356 | |
| 14357 | /* add playback controls from the parsed DAC table */ |
| 14358 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 14359 | const struct auto_pin_cfg *cfg) |
| 14360 | { |
| 14361 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14362 | static const char *chname[4] = { |
| 14363 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 14364 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14365 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14366 | int i, err; |
| 14367 | |
| 14368 | if (cfg->line_outs == 1) { |
| 14369 | const char *pfx = NULL; |
| 14370 | if (!cfg->hp_outs) |
| 14371 | pfx = "Master"; |
| 14372 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 14373 | pfx = "Speaker"; |
| 14374 | if (pfx) { |
| 14375 | nid = spec->multiout.dac_nids[0]; |
| 14376 | return alc861_create_out_sw(codec, pfx, nid, 3); |
| 14377 | } |
| 14378 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14379 | |
| 14380 | for (i = 0; i < cfg->line_outs; i++) { |
| 14381 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14382 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14383 | continue; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14384 | if (i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14385 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14386 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14387 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14388 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14389 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14390 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14391 | return err; |
| 14392 | } else { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14393 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14394 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14395 | return err; |
| 14396 | } |
| 14397 | } |
| 14398 | return 0; |
| 14399 | } |
| 14400 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14401 | 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] | 14402 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14403 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14404 | int err; |
| 14405 | hda_nid_t nid; |
| 14406 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14407 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14408 | return 0; |
| 14409 | |
| 14410 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14411 | nid = alc861_look_for_dac(codec, pin); |
| 14412 | if (nid) { |
| 14413 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 14414 | if (err < 0) |
| 14415 | return err; |
| 14416 | spec->multiout.hp_nid = nid; |
| 14417 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14418 | } |
| 14419 | return 0; |
| 14420 | } |
| 14421 | |
| 14422 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14423 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14424 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14425 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14426 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14427 | } |
| 14428 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14429 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14430 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14431 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14432 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14433 | hda_nid_t mix, srcs[5]; |
| 14434 | int i, num; |
| 14435 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 14436 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14437 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14438 | 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] | 14439 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14440 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 14441 | return; |
| 14442 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 14443 | if (num < 0) |
| 14444 | return; |
| 14445 | for (i = 0; i < num; i++) { |
| 14446 | unsigned int mute; |
| 14447 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 14448 | mute = AMP_IN_UNMUTE(i); |
| 14449 | else |
| 14450 | mute = AMP_IN_MUTE(i); |
| 14451 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14452 | mute); |
| 14453 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14454 | } |
| 14455 | |
| 14456 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 14457 | { |
| 14458 | struct alc_spec *spec = codec->spec; |
| 14459 | int i; |
| 14460 | |
| 14461 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 14462 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14463 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14464 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14465 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14466 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14467 | } |
| 14468 | } |
| 14469 | |
| 14470 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 14471 | { |
| 14472 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14473 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 14474 | if (spec->autocfg.hp_outs) |
| 14475 | alc861_auto_set_output_and_unmute(codec, |
| 14476 | spec->autocfg.hp_pins[0], |
| 14477 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14478 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 14479 | if (spec->autocfg.speaker_outs) |
| 14480 | alc861_auto_set_output_and_unmute(codec, |
| 14481 | spec->autocfg.speaker_pins[0], |
| 14482 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14483 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14484 | } |
| 14485 | |
| 14486 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 14487 | { |
| 14488 | struct alc_spec *spec = codec->spec; |
| 14489 | int i; |
| 14490 | |
| 14491 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14492 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 14493 | if (nid >= 0x0c && nid <= 0x11) |
| 14494 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14495 | } |
| 14496 | } |
| 14497 | |
| 14498 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14499 | /* return 1 if successful, 0 if the proper config is not found, |
| 14500 | * or a negative error code |
| 14501 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14502 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 14503 | { |
| 14504 | struct alc_spec *spec = codec->spec; |
| 14505 | int err; |
| 14506 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 14507 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14508 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14509 | alc861_ignore); |
| 14510 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14511 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14512 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14513 | return 0; /* can't find valid BIOS pin config */ |
| 14514 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14515 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14516 | if (err < 0) |
| 14517 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14518 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14519 | if (err < 0) |
| 14520 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14521 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14522 | if (err < 0) |
| 14523 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14524 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14525 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14526 | return err; |
| 14527 | |
| 14528 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14529 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14530 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14531 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 14532 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14533 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14534 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14535 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14536 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14537 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 14538 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14539 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14540 | |
| 14541 | spec->adc_nids = alc861_adc_nids; |
| 14542 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14543 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14544 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 14545 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); |
| 14546 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14547 | return 1; |
| 14548 | } |
| 14549 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14550 | /* additional initialization for auto-configuration model */ |
| 14551 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14552 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14553 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14554 | alc861_auto_init_multi_out(codec); |
| 14555 | alc861_auto_init_hp_out(codec); |
| 14556 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14557 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14558 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14559 | } |
| 14560 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14561 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14562 | static struct hda_amp_list alc861_loopbacks[] = { |
| 14563 | { 0x15, HDA_INPUT, 0 }, |
| 14564 | { 0x15, HDA_INPUT, 1 }, |
| 14565 | { 0x15, HDA_INPUT, 2 }, |
| 14566 | { 0x15, HDA_INPUT, 3 }, |
| 14567 | { } /* end */ |
| 14568 | }; |
| 14569 | #endif |
| 14570 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14571 | |
| 14572 | /* |
| 14573 | * configuration and preset |
| 14574 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14575 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 14576 | [ALC861_3ST] = "3stack", |
| 14577 | [ALC660_3ST] = "3stack-660", |
| 14578 | [ALC861_3ST_DIG] = "3stack-dig", |
| 14579 | [ALC861_6ST_DIG] = "6stack-dig", |
| 14580 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 14581 | [ALC861_TOSHIBA] = "toshiba", |
| 14582 | [ALC861_ASUS] = "asus", |
| 14583 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 14584 | [ALC861_AUTO] = "auto", |
| 14585 | }; |
| 14586 | |
| 14587 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 14588 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14589 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14590 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14591 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14592 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 14593 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 14594 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 14595 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 14596 | * Any other models that need this preset? |
| 14597 | */ |
| 14598 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 14599 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 14600 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14601 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 14602 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 14603 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 14604 | /* FIXME: the below seems conflict */ |
| 14605 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 14606 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 14607 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14608 | {} |
| 14609 | }; |
| 14610 | |
| 14611 | static struct alc_config_preset alc861_presets[] = { |
| 14612 | [ALC861_3ST] = { |
| 14613 | .mixers = { alc861_3ST_mixer }, |
| 14614 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14615 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14616 | .dac_nids = alc861_dac_nids, |
| 14617 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14618 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14619 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14620 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14621 | .adc_nids = alc861_adc_nids, |
| 14622 | .input_mux = &alc861_capture_source, |
| 14623 | }, |
| 14624 | [ALC861_3ST_DIG] = { |
| 14625 | .mixers = { alc861_base_mixer }, |
| 14626 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14627 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14628 | .dac_nids = alc861_dac_nids, |
| 14629 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14630 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14631 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14632 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14633 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14634 | .adc_nids = alc861_adc_nids, |
| 14635 | .input_mux = &alc861_capture_source, |
| 14636 | }, |
| 14637 | [ALC861_6ST_DIG] = { |
| 14638 | .mixers = { alc861_base_mixer }, |
| 14639 | .init_verbs = { alc861_base_init_verbs }, |
| 14640 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14641 | .dac_nids = alc861_dac_nids, |
| 14642 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14643 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 14644 | .channel_mode = alc861_8ch_modes, |
| 14645 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14646 | .adc_nids = alc861_adc_nids, |
| 14647 | .input_mux = &alc861_capture_source, |
| 14648 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14649 | [ALC660_3ST] = { |
| 14650 | .mixers = { alc861_3ST_mixer }, |
| 14651 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14652 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 14653 | .dac_nids = alc660_dac_nids, |
| 14654 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14655 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14656 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14657 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14658 | .adc_nids = alc861_adc_nids, |
| 14659 | .input_mux = &alc861_capture_source, |
| 14660 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14661 | [ALC861_UNIWILL_M31] = { |
| 14662 | .mixers = { alc861_uniwill_m31_mixer }, |
| 14663 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 14664 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14665 | .dac_nids = alc861_dac_nids, |
| 14666 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14667 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14668 | .channel_mode = alc861_uniwill_m31_modes, |
| 14669 | .need_dac_fix = 1, |
| 14670 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14671 | .adc_nids = alc861_adc_nids, |
| 14672 | .input_mux = &alc861_capture_source, |
| 14673 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14674 | [ALC861_TOSHIBA] = { |
| 14675 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14676 | .init_verbs = { alc861_base_init_verbs, |
| 14677 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14678 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14679 | .dac_nids = alc861_dac_nids, |
| 14680 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14681 | .channel_mode = alc883_3ST_2ch_modes, |
| 14682 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14683 | .adc_nids = alc861_adc_nids, |
| 14684 | .input_mux = &alc861_capture_source, |
| 14685 | .unsol_event = alc861_toshiba_unsol_event, |
| 14686 | .init_hook = alc861_toshiba_automute, |
| 14687 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14688 | [ALC861_ASUS] = { |
| 14689 | .mixers = { alc861_asus_mixer }, |
| 14690 | .init_verbs = { alc861_asus_init_verbs }, |
| 14691 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14692 | .dac_nids = alc861_dac_nids, |
| 14693 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14694 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 14695 | .channel_mode = alc861_asus_modes, |
| 14696 | .need_dac_fix = 1, |
| 14697 | .hp_nid = 0x06, |
| 14698 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14699 | .adc_nids = alc861_adc_nids, |
| 14700 | .input_mux = &alc861_capture_source, |
| 14701 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14702 | [ALC861_ASUS_LAPTOP] = { |
| 14703 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 14704 | .init_verbs = { alc861_asus_init_verbs, |
| 14705 | alc861_asus_laptop_init_verbs }, |
| 14706 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14707 | .dac_nids = alc861_dac_nids, |
| 14708 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14709 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14710 | .channel_mode = alc883_3ST_2ch_modes, |
| 14711 | .need_dac_fix = 1, |
| 14712 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14713 | .adc_nids = alc861_adc_nids, |
| 14714 | .input_mux = &alc861_capture_source, |
| 14715 | }, |
| 14716 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14717 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 14718 | /* Pin config fixes */ |
| 14719 | enum { |
| 14720 | PINFIX_FSC_AMILO_PI1505, |
| 14721 | }; |
| 14722 | |
| 14723 | static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = { |
| 14724 | { 0x0b, 0x0221101f }, /* HP */ |
| 14725 | { 0x0f, 0x90170310 }, /* speaker */ |
| 14726 | { } |
| 14727 | }; |
| 14728 | |
| 14729 | static const struct alc_fixup alc861_fixups[] = { |
| 14730 | [PINFIX_FSC_AMILO_PI1505] = { |
| 14731 | .pins = alc861_fsc_amilo_pi1505_pinfix |
| 14732 | }, |
| 14733 | }; |
| 14734 | |
| 14735 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 14736 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 14737 | {} |
| 14738 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14739 | |
| 14740 | static int patch_alc861(struct hda_codec *codec) |
| 14741 | { |
| 14742 | struct alc_spec *spec; |
| 14743 | int board_config; |
| 14744 | int err; |
| 14745 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 14746 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14747 | if (spec == NULL) |
| 14748 | return -ENOMEM; |
| 14749 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14750 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14751 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14752 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 14753 | alc861_models, |
| 14754 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14755 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14756 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14757 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14758 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14759 | board_config = ALC861_AUTO; |
| 14760 | } |
| 14761 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 14762 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups); |
| 14763 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14764 | if (board_config == ALC861_AUTO) { |
| 14765 | /* automatic parse from the BIOS config */ |
| 14766 | err = alc861_parse_auto_config(codec); |
| 14767 | if (err < 0) { |
| 14768 | alc_free(codec); |
| 14769 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14770 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14771 | printk(KERN_INFO |
| 14772 | "hda_codec: Cannot set up configuration " |
| 14773 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14774 | board_config = ALC861_3ST_DIG; |
| 14775 | } |
| 14776 | } |
| 14777 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14778 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14779 | if (err < 0) { |
| 14780 | alc_free(codec); |
| 14781 | return err; |
| 14782 | } |
| 14783 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14784 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14785 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14786 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14787 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 14788 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 14789 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14790 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 14791 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 14792 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14793 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 14794 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14795 | spec->vmaster_nid = 0x03; |
| 14796 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14797 | codec->patch_ops = alc_patch_ops; |
| 14798 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14799 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14800 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14801 | if (!spec->loopback.amplist) |
| 14802 | spec->loopback.amplist = alc861_loopbacks; |
| 14803 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 14804 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14805 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14806 | return 0; |
| 14807 | } |
| 14808 | |
| 14809 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14810 | * ALC861-VD support |
| 14811 | * |
| 14812 | * Based on ALC882 |
| 14813 | * |
| 14814 | * In addition, an independent DAC |
| 14815 | */ |
| 14816 | #define ALC861VD_DIGOUT_NID 0x06 |
| 14817 | |
| 14818 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 14819 | /* front, surr, clfe, side surr */ |
| 14820 | 0x02, 0x03, 0x04, 0x05 |
| 14821 | }; |
| 14822 | |
| 14823 | /* dac_nids for ALC660vd are in a different order - according to |
| 14824 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14825 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14826 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 14827 | * - and it is the same as in 861vd. |
| 14828 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 14829 | */ |
| 14830 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 14831 | /* front, rear, clfe, rear_surr */ |
| 14832 | 0x02, 0x04, 0x03 |
| 14833 | }; |
| 14834 | |
| 14835 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 14836 | /* ADC0 */ |
| 14837 | 0x09, |
| 14838 | }; |
| 14839 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14840 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 14841 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14842 | /* input MUX */ |
| 14843 | /* FIXME: should be a matrix-type input source selection */ |
| 14844 | static struct hda_input_mux alc861vd_capture_source = { |
| 14845 | .num_items = 4, |
| 14846 | .items = { |
| 14847 | { "Mic", 0x0 }, |
| 14848 | { "Front Mic", 0x1 }, |
| 14849 | { "Line", 0x2 }, |
| 14850 | { "CD", 0x4 }, |
| 14851 | }, |
| 14852 | }; |
| 14853 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14854 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14855 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14856 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14857 | { "Ext Mic", 0x0 }, |
| 14858 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14859 | }, |
| 14860 | }; |
| 14861 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14862 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 14863 | .num_items = 2, |
| 14864 | .items = { |
| 14865 | { "Front Mic", 0x0 }, |
| 14866 | { "ATAPI Mic", 0x1 }, |
| 14867 | }, |
| 14868 | }; |
| 14869 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14870 | /* |
| 14871 | * 2ch mode |
| 14872 | */ |
| 14873 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 14874 | { 2, NULL } |
| 14875 | }; |
| 14876 | |
| 14877 | /* |
| 14878 | * 6ch mode |
| 14879 | */ |
| 14880 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 14881 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14882 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14883 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14884 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14885 | { } /* end */ |
| 14886 | }; |
| 14887 | |
| 14888 | /* |
| 14889 | * 8ch mode |
| 14890 | */ |
| 14891 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 14892 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14893 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14894 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14895 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14896 | { } /* end */ |
| 14897 | }; |
| 14898 | |
| 14899 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 14900 | { 6, alc861vd_6stack_ch6_init }, |
| 14901 | { 8, alc861vd_6stack_ch8_init }, |
| 14902 | }; |
| 14903 | |
| 14904 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 14905 | { |
| 14906 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14907 | .name = "Channel Mode", |
| 14908 | .info = alc_ch_mode_info, |
| 14909 | .get = alc_ch_mode_get, |
| 14910 | .put = alc_ch_mode_put, |
| 14911 | }, |
| 14912 | { } /* end */ |
| 14913 | }; |
| 14914 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14915 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14916 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14917 | */ |
| 14918 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 14919 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14920 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14921 | |
| 14922 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14923 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14924 | |
| 14925 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 14926 | HDA_OUTPUT), |
| 14927 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 14928 | HDA_OUTPUT), |
| 14929 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 14930 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 14931 | |
| 14932 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 14933 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 14934 | |
| 14935 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14936 | |
| 14937 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14938 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14939 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14940 | |
| 14941 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14942 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14943 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14944 | |
| 14945 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14946 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14947 | |
| 14948 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14949 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14950 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14951 | { } /* end */ |
| 14952 | }; |
| 14953 | |
| 14954 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 14955 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14956 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14957 | |
| 14958 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14959 | |
| 14960 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14961 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14962 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14963 | |
| 14964 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14965 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14966 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14967 | |
| 14968 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14969 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14970 | |
| 14971 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14972 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14973 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14974 | { } /* end */ |
| 14975 | }; |
| 14976 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14977 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 14978 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14979 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 14980 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14981 | |
| 14982 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14983 | |
| 14984 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14985 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14986 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14987 | |
| 14988 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14989 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14990 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14991 | |
| 14992 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14993 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14994 | |
| 14995 | { } /* end */ |
| 14996 | }; |
| 14997 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14998 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 14999 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15000 | */ |
| 15001 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15002 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15003 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15004 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15005 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15006 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 15007 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15008 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15009 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 15010 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15011 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15012 | { } /* end */ |
| 15013 | }; |
| 15014 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15015 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 15016 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 15017 | */ |
| 15018 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 15019 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15020 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15021 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15022 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 15023 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15024 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15025 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15026 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15027 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15028 | { } /* end */ |
| 15029 | }; |
| 15030 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15031 | /* |
| 15032 | * generic initialization of ADC, input mixers and output mixers |
| 15033 | */ |
| 15034 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 15035 | /* |
| 15036 | * Unmute ADC0 and set the default input to mic-in |
| 15037 | */ |
| 15038 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15039 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15040 | |
| 15041 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 15042 | * the analog-loopback mixer widget |
| 15043 | */ |
| 15044 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15045 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15046 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15047 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15048 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15049 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15050 | |
| 15051 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15052 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15053 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15054 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15055 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15056 | |
| 15057 | /* |
| 15058 | * Set up output mixers (0x02 - 0x05) |
| 15059 | */ |
| 15060 | /* set vol=0 to output mixers */ |
| 15061 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15062 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15063 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15064 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15065 | |
| 15066 | /* set up input amps for analog loopback */ |
| 15067 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 15068 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15069 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15070 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15071 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15072 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15073 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15074 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15075 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15076 | |
| 15077 | { } |
| 15078 | }; |
| 15079 | |
| 15080 | /* |
| 15081 | * 3-stack pin configuration: |
| 15082 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 15083 | */ |
| 15084 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 15085 | /* |
| 15086 | * Set pin mode and muting |
| 15087 | */ |
| 15088 | /* set front pin widgets 0x14 for output */ |
| 15089 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15090 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15091 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15092 | |
| 15093 | /* Mic (rear) pin: input vref at 80% */ |
| 15094 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15095 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15096 | /* Front Mic pin: input vref at 80% */ |
| 15097 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15098 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15099 | /* Line In pin: input */ |
| 15100 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15101 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15102 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15103 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15104 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15105 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15106 | /* CD pin widget for input */ |
| 15107 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15108 | |
| 15109 | { } |
| 15110 | }; |
| 15111 | |
| 15112 | /* |
| 15113 | * 6-stack pin configuration: |
| 15114 | */ |
| 15115 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 15116 | /* |
| 15117 | * Set pin mode and muting |
| 15118 | */ |
| 15119 | /* set front pin widgets 0x14 for output */ |
| 15120 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15121 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15122 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15123 | |
| 15124 | /* Rear Pin: output 1 (0x0d) */ |
| 15125 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15126 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15127 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 15128 | /* CLFE Pin: output 2 (0x0e) */ |
| 15129 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15130 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15131 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 15132 | /* Side Pin: output 3 (0x0f) */ |
| 15133 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15134 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15135 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 15136 | |
| 15137 | /* Mic (rear) pin: input vref at 80% */ |
| 15138 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15139 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15140 | /* Front Mic pin: input vref at 80% */ |
| 15141 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15142 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15143 | /* Line In pin: input */ |
| 15144 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15145 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15146 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15147 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15148 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15149 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15150 | /* CD pin widget for input */ |
| 15151 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15152 | |
| 15153 | { } |
| 15154 | }; |
| 15155 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15156 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 15157 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15158 | { } |
| 15159 | }; |
| 15160 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15161 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 15162 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15163 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15164 | { } |
| 15165 | }; |
| 15166 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15167 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 15168 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15169 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15170 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 15171 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15172 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15173 | {} |
| 15174 | }; |
| 15175 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15176 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 15177 | { |
| 15178 | unsigned int present; |
| 15179 | unsigned char bits; |
| 15180 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15181 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15182 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15183 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15184 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 15185 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15186 | } |
| 15187 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15188 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15189 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15190 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15191 | spec->autocfg.hp_pins[0] = 0x1b; |
| 15192 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15193 | } |
| 15194 | |
| 15195 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 15196 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15197 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15198 | alc861vd_lenovo_mic_automute(codec); |
| 15199 | } |
| 15200 | |
| 15201 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 15202 | unsigned int res) |
| 15203 | { |
| 15204 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15205 | case ALC880_MIC_EVENT: |
| 15206 | alc861vd_lenovo_mic_automute(codec); |
| 15207 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15208 | default: |
| 15209 | alc_automute_amp_unsol_event(codec, res); |
| 15210 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15211 | } |
| 15212 | } |
| 15213 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15214 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 15215 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15216 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15217 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15218 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15219 | |
| 15220 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15221 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15222 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15223 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15224 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15225 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15226 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15227 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15228 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15229 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15230 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15231 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15232 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15233 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15234 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15235 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15236 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15237 | |
| 15238 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15239 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15240 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15241 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15242 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15243 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15244 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15245 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15246 | |
| 15247 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15248 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15249 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15250 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 15251 | |
| 15252 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15253 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15254 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15255 | |
| 15256 | { } /* end */ |
| 15257 | }; |
| 15258 | |
| 15259 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15260 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15261 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15262 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15263 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15264 | spec->autocfg.hp_pins[0] = 0x15; |
| 15265 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15266 | } |
| 15267 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15268 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15269 | #define alc861vd_loopbacks alc880_loopbacks |
| 15270 | #endif |
| 15271 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15272 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15273 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 15274 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 15275 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 15276 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 15277 | |
| 15278 | /* |
| 15279 | * configuration and preset |
| 15280 | */ |
| 15281 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 15282 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15283 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15284 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15285 | [ALC861VD_3ST] = "3stack", |
| 15286 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 15287 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15288 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15289 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15290 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15291 | [ALC861VD_AUTO] = "auto", |
| 15292 | }; |
| 15293 | |
| 15294 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15295 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 15296 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 15297 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 15298 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15299 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15300 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15301 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15302 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 15303 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 15304 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 15305 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15306 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 15307 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 15308 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 15309 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15310 | {} |
| 15311 | }; |
| 15312 | |
| 15313 | static struct alc_config_preset alc861vd_presets[] = { |
| 15314 | [ALC660VD_3ST] = { |
| 15315 | .mixers = { alc861vd_3st_mixer }, |
| 15316 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15317 | alc861vd_3stack_init_verbs }, |
| 15318 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15319 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15320 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15321 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15322 | .input_mux = &alc861vd_capture_source, |
| 15323 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15324 | [ALC660VD_3ST_DIG] = { |
| 15325 | .mixers = { alc861vd_3st_mixer }, |
| 15326 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15327 | alc861vd_3stack_init_verbs }, |
| 15328 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15329 | .dac_nids = alc660vd_dac_nids, |
| 15330 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15331 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15332 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15333 | .input_mux = &alc861vd_capture_source, |
| 15334 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15335 | [ALC861VD_3ST] = { |
| 15336 | .mixers = { alc861vd_3st_mixer }, |
| 15337 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15338 | alc861vd_3stack_init_verbs }, |
| 15339 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15340 | .dac_nids = alc861vd_dac_nids, |
| 15341 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15342 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15343 | .input_mux = &alc861vd_capture_source, |
| 15344 | }, |
| 15345 | [ALC861VD_3ST_DIG] = { |
| 15346 | .mixers = { alc861vd_3st_mixer }, |
| 15347 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15348 | alc861vd_3stack_init_verbs }, |
| 15349 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15350 | .dac_nids = alc861vd_dac_nids, |
| 15351 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15352 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15353 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15354 | .input_mux = &alc861vd_capture_source, |
| 15355 | }, |
| 15356 | [ALC861VD_6ST_DIG] = { |
| 15357 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 15358 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15359 | alc861vd_6stack_init_verbs }, |
| 15360 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15361 | .dac_nids = alc861vd_dac_nids, |
| 15362 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15363 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 15364 | .channel_mode = alc861vd_6stack_modes, |
| 15365 | .input_mux = &alc861vd_capture_source, |
| 15366 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15367 | [ALC861VD_LENOVO] = { |
| 15368 | .mixers = { alc861vd_lenovo_mixer }, |
| 15369 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15370 | alc861vd_3stack_init_verbs, |
| 15371 | alc861vd_eapd_verbs, |
| 15372 | alc861vd_lenovo_unsol_verbs }, |
| 15373 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15374 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15375 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15376 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15377 | .input_mux = &alc861vd_capture_source, |
| 15378 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15379 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15380 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15381 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15382 | [ALC861VD_DALLAS] = { |
| 15383 | .mixers = { alc861vd_dallas_mixer }, |
| 15384 | .init_verbs = { alc861vd_dallas_verbs }, |
| 15385 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15386 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15387 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15388 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15389 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15390 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15391 | .setup = alc861vd_dallas_setup, |
| 15392 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15393 | }, |
| 15394 | [ALC861VD_HP] = { |
| 15395 | .mixers = { alc861vd_hp_mixer }, |
| 15396 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 15397 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15398 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15399 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15400 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15401 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15402 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15403 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15404 | .setup = alc861vd_dallas_setup, |
| 15405 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15406 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15407 | [ALC660VD_ASUS_V1S] = { |
| 15408 | .mixers = { alc861vd_lenovo_mixer }, |
| 15409 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15410 | alc861vd_3stack_init_verbs, |
| 15411 | alc861vd_eapd_verbs, |
| 15412 | alc861vd_lenovo_unsol_verbs }, |
| 15413 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15414 | .dac_nids = alc660vd_dac_nids, |
| 15415 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15416 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15417 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15418 | .input_mux = &alc861vd_capture_source, |
| 15419 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15420 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15421 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15422 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15423 | }; |
| 15424 | |
| 15425 | /* |
| 15426 | * BIOS auto configuration |
| 15427 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15428 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 15429 | const struct auto_pin_cfg *cfg) |
| 15430 | { |
| 15431 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); |
| 15432 | } |
| 15433 | |
| 15434 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15435 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15436 | hda_nid_t nid, int pin_type, int dac_idx) |
| 15437 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15438 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15439 | } |
| 15440 | |
| 15441 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 15442 | { |
| 15443 | struct alc_spec *spec = codec->spec; |
| 15444 | int i; |
| 15445 | |
| 15446 | for (i = 0; i <= HDA_SIDE; i++) { |
| 15447 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15448 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15449 | if (nid) |
| 15450 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15451 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15452 | } |
| 15453 | } |
| 15454 | |
| 15455 | |
| 15456 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 15457 | { |
| 15458 | struct alc_spec *spec = codec->spec; |
| 15459 | hda_nid_t pin; |
| 15460 | |
| 15461 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15462 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15463 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15464 | pin = spec->autocfg.speaker_pins[0]; |
| 15465 | if (pin) |
| 15466 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15467 | } |
| 15468 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15469 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 15470 | |
| 15471 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 15472 | { |
| 15473 | struct alc_spec *spec = codec->spec; |
| 15474 | int i; |
| 15475 | |
| 15476 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15477 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15478 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15479 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 15480 | if (nid != ALC861VD_PIN_CD_NID && |
| 15481 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15482 | snd_hda_codec_write(codec, nid, 0, |
| 15483 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 15484 | AMP_OUT_MUTE); |
| 15485 | } |
| 15486 | } |
| 15487 | } |
| 15488 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15489 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 15490 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15491 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 15492 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 15493 | |
| 15494 | /* add playback controls from the parsed DAC table */ |
| 15495 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15496 | * different NIDs for mute/unmute switch and volume control */ |
| 15497 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 15498 | const struct auto_pin_cfg *cfg) |
| 15499 | { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15500 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 15501 | hda_nid_t nid_v, nid_s; |
| 15502 | int i, err; |
| 15503 | |
| 15504 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15505 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15506 | continue; |
| 15507 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15508 | alc880_dac_to_idx( |
| 15509 | spec->multiout.dac_nids[i])); |
| 15510 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15511 | alc880_dac_to_idx( |
| 15512 | spec->multiout.dac_nids[i])); |
| 15513 | |
| 15514 | if (i == 2) { |
| 15515 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15516 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 15517 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15518 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 15519 | HDA_OUTPUT)); |
| 15520 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15521 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15522 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 15523 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15524 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 15525 | HDA_OUTPUT)); |
| 15526 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15527 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15528 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 15529 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15530 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 15531 | HDA_INPUT)); |
| 15532 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15533 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15534 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 15535 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15536 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 15537 | HDA_INPUT)); |
| 15538 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15539 | return err; |
| 15540 | } else { |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 15541 | const char *pfx; |
| 15542 | if (cfg->line_outs == 1 && |
| 15543 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
| 15544 | if (!cfg->hp_pins) |
| 15545 | pfx = "Speaker"; |
| 15546 | else |
| 15547 | pfx = "PCM"; |
| 15548 | } else |
| 15549 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15550 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15551 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 15552 | HDA_OUTPUT)); |
| 15553 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15554 | return err; |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 15555 | if (cfg->line_outs == 1 && |
| 15556 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 15557 | pfx = "Speaker"; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15558 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15559 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15560 | HDA_INPUT)); |
| 15561 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15562 | return err; |
| 15563 | } |
| 15564 | } |
| 15565 | return 0; |
| 15566 | } |
| 15567 | |
| 15568 | /* add playback controls for speaker and HP outputs */ |
| 15569 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15570 | * different NIDs for mute/unmute switch and volume control */ |
| 15571 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 15572 | hda_nid_t pin, const char *pfx) |
| 15573 | { |
| 15574 | hda_nid_t nid_v, nid_s; |
| 15575 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15576 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15577 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15578 | return 0; |
| 15579 | |
| 15580 | if (alc880_is_fixed_pin(pin)) { |
| 15581 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 15582 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15583 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15584 | spec->multiout.hp_nid = nid_v; |
| 15585 | else |
| 15586 | spec->multiout.extra_out_nid[0] = nid_v; |
| 15587 | /* control HP volume/switch on the output mixer amp */ |
| 15588 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15589 | alc880_fixed_pin_idx(pin)); |
| 15590 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15591 | alc880_fixed_pin_idx(pin)); |
| 15592 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15593 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15594 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 15595 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15596 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15597 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15598 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 15599 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15600 | return err; |
| 15601 | } else if (alc880_is_multi_pin(pin)) { |
| 15602 | /* set manual connection */ |
| 15603 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15604 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15605 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 15606 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15607 | return err; |
| 15608 | } |
| 15609 | return 0; |
| 15610 | } |
| 15611 | |
| 15612 | /* parse the BIOS configuration and set up the alc_spec |
| 15613 | * return 1 if successful, 0 if the proper config is not found, |
| 15614 | * or a negative error code |
| 15615 | * Based on ALC880 version - had to change it to override |
| 15616 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 15617 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 15618 | { |
| 15619 | struct alc_spec *spec = codec->spec; |
| 15620 | int err; |
| 15621 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 15622 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15623 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15624 | alc861vd_ignore); |
| 15625 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15626 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15627 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15628 | return 0; /* can't find valid BIOS pin config */ |
| 15629 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15630 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 15631 | if (err < 0) |
| 15632 | return err; |
| 15633 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 15634 | if (err < 0) |
| 15635 | return err; |
| 15636 | err = alc861vd_auto_create_extra_out(spec, |
| 15637 | spec->autocfg.speaker_pins[0], |
| 15638 | "Speaker"); |
| 15639 | if (err < 0) |
| 15640 | return err; |
| 15641 | err = alc861vd_auto_create_extra_out(spec, |
| 15642 | spec->autocfg.hp_pins[0], |
| 15643 | "Headphone"); |
| 15644 | if (err < 0) |
| 15645 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15646 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15647 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15648 | return err; |
| 15649 | |
| 15650 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15651 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 15652 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15653 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 15654 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15655 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15656 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15657 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15658 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15659 | |
| 15660 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15661 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15662 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 15663 | err = alc_auto_add_mic_boost(codec); |
| 15664 | if (err < 0) |
| 15665 | return err; |
| 15666 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15667 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 15668 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15669 | return 1; |
| 15670 | } |
| 15671 | |
| 15672 | /* additional initialization for auto-configuration model */ |
| 15673 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 15674 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15675 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15676 | alc861vd_auto_init_multi_out(codec); |
| 15677 | alc861vd_auto_init_hp_out(codec); |
| 15678 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15679 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15680 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15681 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15682 | } |
| 15683 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 15684 | enum { |
| 15685 | ALC660VD_FIX_ASUS_GPIO1 |
| 15686 | }; |
| 15687 | |
| 15688 | /* reset GPIO1 */ |
| 15689 | static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = { |
| 15690 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 15691 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 15692 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 15693 | { } |
| 15694 | }; |
| 15695 | |
| 15696 | static const struct alc_fixup alc861vd_fixups[] = { |
| 15697 | [ALC660VD_FIX_ASUS_GPIO1] = { |
| 15698 | .verbs = alc660vd_fix_asus_gpio1_verbs, |
| 15699 | }, |
| 15700 | }; |
| 15701 | |
| 15702 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 15703 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 15704 | {} |
| 15705 | }; |
| 15706 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15707 | static int patch_alc861vd(struct hda_codec *codec) |
| 15708 | { |
| 15709 | struct alc_spec *spec; |
| 15710 | int err, board_config; |
| 15711 | |
| 15712 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15713 | if (spec == NULL) |
| 15714 | return -ENOMEM; |
| 15715 | |
| 15716 | codec->spec = spec; |
| 15717 | |
| 15718 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 15719 | alc861vd_models, |
| 15720 | alc861vd_cfg_tbl); |
| 15721 | |
| 15722 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15723 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15724 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15725 | board_config = ALC861VD_AUTO; |
| 15726 | } |
| 15727 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 15728 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups); |
| 15729 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15730 | if (board_config == ALC861VD_AUTO) { |
| 15731 | /* automatic parse from the BIOS config */ |
| 15732 | err = alc861vd_parse_auto_config(codec); |
| 15733 | if (err < 0) { |
| 15734 | alc_free(codec); |
| 15735 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15736 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15737 | printk(KERN_INFO |
| 15738 | "hda_codec: Cannot set up configuration " |
| 15739 | "from BIOS. Using base mode...\n"); |
| 15740 | board_config = ALC861VD_3ST; |
| 15741 | } |
| 15742 | } |
| 15743 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15744 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15745 | if (err < 0) { |
| 15746 | alc_free(codec); |
| 15747 | return err; |
| 15748 | } |
| 15749 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15750 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15751 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15752 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15753 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15754 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15755 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15756 | } |
| 15757 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15758 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 15759 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 15760 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15761 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 15762 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 15763 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 15764 | if (!spec->adc_nids) { |
| 15765 | spec->adc_nids = alc861vd_adc_nids; |
| 15766 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 15767 | } |
| 15768 | if (!spec->capsrc_nids) |
| 15769 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15770 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15771 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15772 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15773 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15774 | spec->vmaster_nid = 0x02; |
| 15775 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15776 | codec->patch_ops = alc_patch_ops; |
| 15777 | |
| 15778 | if (board_config == ALC861VD_AUTO) |
| 15779 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15780 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15781 | if (!spec->loopback.amplist) |
| 15782 | spec->loopback.amplist = alc861vd_loopbacks; |
| 15783 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 15784 | codec->proc_widget_hook = print_realtek_coef; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15785 | |
| 15786 | return 0; |
| 15787 | } |
| 15788 | |
| 15789 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15790 | * ALC662 support |
| 15791 | * |
| 15792 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 15793 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 15794 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 15795 | * 6-channel independent captures. |
| 15796 | * |
| 15797 | * In addition, an independent DAC for the multi-playback (not used in this |
| 15798 | * driver yet). |
| 15799 | */ |
| 15800 | #define ALC662_DIGOUT_NID 0x06 |
| 15801 | #define ALC662_DIGIN_NID 0x0a |
| 15802 | |
| 15803 | static hda_nid_t alc662_dac_nids[4] = { |
| 15804 | /* front, rear, clfe, rear_surr */ |
| 15805 | 0x02, 0x03, 0x04 |
| 15806 | }; |
| 15807 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15808 | static hda_nid_t alc272_dac_nids[2] = { |
| 15809 | 0x02, 0x03 |
| 15810 | }; |
| 15811 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15812 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15813 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15814 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15815 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15816 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15817 | static hda_nid_t alc272_adc_nids[1] = { |
| 15818 | /* ADC1-2 */ |
| 15819 | 0x08, |
| 15820 | }; |
| 15821 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15822 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15823 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 15824 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15825 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15826 | /* input MUX */ |
| 15827 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15828 | static struct hda_input_mux alc662_capture_source = { |
| 15829 | .num_items = 4, |
| 15830 | .items = { |
| 15831 | { "Mic", 0x0 }, |
| 15832 | { "Front Mic", 0x1 }, |
| 15833 | { "Line", 0x2 }, |
| 15834 | { "CD", 0x4 }, |
| 15835 | }, |
| 15836 | }; |
| 15837 | |
| 15838 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 15839 | .num_items = 2, |
| 15840 | .items = { |
| 15841 | { "Mic", 0x1 }, |
| 15842 | { "Line", 0x2 }, |
| 15843 | }, |
| 15844 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15845 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15846 | static struct hda_input_mux alc663_capture_source = { |
| 15847 | .num_items = 3, |
| 15848 | .items = { |
| 15849 | { "Mic", 0x0 }, |
| 15850 | { "Front Mic", 0x1 }, |
| 15851 | { "Line", 0x2 }, |
| 15852 | }, |
| 15853 | }; |
| 15854 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15855 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 15856 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15857 | .num_items = 16, |
| 15858 | .items = { |
| 15859 | { "Autoselect Mic", 0x0 }, |
| 15860 | { "Internal Mic", 0x1 }, |
| 15861 | { "In-0x02", 0x2 }, |
| 15862 | { "In-0x03", 0x3 }, |
| 15863 | { "In-0x04", 0x4 }, |
| 15864 | { "In-0x05", 0x5 }, |
| 15865 | { "In-0x06", 0x6 }, |
| 15866 | { "In-0x07", 0x7 }, |
| 15867 | { "In-0x08", 0x8 }, |
| 15868 | { "In-0x09", 0x9 }, |
| 15869 | { "In-0x0a", 0x0a }, |
| 15870 | { "In-0x0b", 0x0b }, |
| 15871 | { "In-0x0c", 0x0c }, |
| 15872 | { "In-0x0d", 0x0d }, |
| 15873 | { "In-0x0e", 0x0e }, |
| 15874 | { "In-0x0f", 0x0f }, |
| 15875 | }, |
| 15876 | }; |
| 15877 | #endif |
| 15878 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15879 | /* |
| 15880 | * 2ch mode |
| 15881 | */ |
| 15882 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 15883 | { 2, NULL } |
| 15884 | }; |
| 15885 | |
| 15886 | /* |
| 15887 | * 2ch mode |
| 15888 | */ |
| 15889 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 15890 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 15891 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15892 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 15893 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15894 | { } /* end */ |
| 15895 | }; |
| 15896 | |
| 15897 | /* |
| 15898 | * 6ch mode |
| 15899 | */ |
| 15900 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 15901 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15902 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15903 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 15904 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15905 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15906 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15907 | { } /* end */ |
| 15908 | }; |
| 15909 | |
| 15910 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 15911 | { 2, alc662_3ST_ch2_init }, |
| 15912 | { 6, alc662_3ST_ch6_init }, |
| 15913 | }; |
| 15914 | |
| 15915 | /* |
| 15916 | * 2ch mode |
| 15917 | */ |
| 15918 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 15919 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15920 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15921 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15922 | { } /* end */ |
| 15923 | }; |
| 15924 | |
| 15925 | /* |
| 15926 | * 6ch mode |
| 15927 | */ |
| 15928 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 15929 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15930 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15931 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15932 | { } /* end */ |
| 15933 | }; |
| 15934 | |
| 15935 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 15936 | { 2, alc662_sixstack_ch6_init }, |
| 15937 | { 6, alc662_sixstack_ch8_init }, |
| 15938 | }; |
| 15939 | |
| 15940 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15941 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15942 | */ |
| 15943 | |
| 15944 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 15945 | /* output mixer control */ |
| 15946 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15947 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15948 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15949 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15950 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15951 | 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] | 15952 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15953 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15954 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15955 | |
| 15956 | /*Input mixer control */ |
| 15957 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 15958 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 15959 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 15960 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 15961 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 15962 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 15963 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 15964 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15965 | { } /* end */ |
| 15966 | }; |
| 15967 | |
| 15968 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 15969 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15970 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15971 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15972 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15973 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15974 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15975 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15976 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15977 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15978 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15979 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15980 | { } /* end */ |
| 15981 | }; |
| 15982 | |
| 15983 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 15984 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15985 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15986 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15987 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15988 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15989 | 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] | 15990 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15991 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15992 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15993 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15994 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15995 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15996 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15997 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15998 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15999 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16000 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16001 | { } /* end */ |
| 16002 | }; |
| 16003 | |
| 16004 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 16005 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16006 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 16007 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16008 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16009 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16010 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16011 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16012 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16013 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16014 | { } /* end */ |
| 16015 | }; |
| 16016 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16017 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16018 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16019 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16020 | |
| 16021 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 16022 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16023 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16024 | |
| 16025 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16026 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16027 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16028 | { } /* end */ |
| 16029 | }; |
| 16030 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16031 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16032 | ALC262_HIPPO_MASTER_SWITCH, |
| 16033 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16034 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16035 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 16036 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16037 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16038 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16039 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16040 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16041 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16042 | { } /* end */ |
| 16043 | }; |
| 16044 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16045 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 16046 | .ops = &snd_hda_bind_vol, |
| 16047 | .values = { |
| 16048 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 16049 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 16050 | 0 |
| 16051 | }, |
| 16052 | }; |
| 16053 | |
| 16054 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 16055 | .ops = &snd_hda_bind_sw, |
| 16056 | .values = { |
| 16057 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16058 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 16059 | 0 |
| 16060 | }, |
| 16061 | }; |
| 16062 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16063 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16064 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16065 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 16066 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16067 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16068 | { } /* end */ |
| 16069 | }; |
| 16070 | |
| 16071 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 16072 | .ops = &snd_hda_bind_sw, |
| 16073 | .values = { |
| 16074 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16075 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 16076 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 16077 | 0 |
| 16078 | }, |
| 16079 | }; |
| 16080 | |
| 16081 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 16082 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16083 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 16084 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16085 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16086 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16087 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16088 | |
| 16089 | { } /* end */ |
| 16090 | }; |
| 16091 | |
| 16092 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 16093 | .ops = &snd_hda_bind_sw, |
| 16094 | .values = { |
| 16095 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16096 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 16097 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 16098 | 0 |
| 16099 | }, |
| 16100 | }; |
| 16101 | |
| 16102 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 16103 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16104 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 16105 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16106 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16107 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16108 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16109 | { } /* end */ |
| 16110 | }; |
| 16111 | |
| 16112 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16113 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16114 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16115 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16116 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16117 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16118 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16119 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16120 | { } /* end */ |
| 16121 | }; |
| 16122 | |
| 16123 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 16124 | .ops = &snd_hda_bind_vol, |
| 16125 | .values = { |
| 16126 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 16127 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 16128 | 0 |
| 16129 | }, |
| 16130 | }; |
| 16131 | |
| 16132 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 16133 | .ops = &snd_hda_bind_sw, |
| 16134 | .values = { |
| 16135 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16136 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 16137 | 0 |
| 16138 | }, |
| 16139 | }; |
| 16140 | |
| 16141 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 16142 | HDA_BIND_VOL("Master Playback Volume", |
| 16143 | &alc663_asus_two_bind_master_vol), |
| 16144 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 16145 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16146 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16147 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16148 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16149 | { } /* end */ |
| 16150 | }; |
| 16151 | |
| 16152 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 16153 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16154 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 16155 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16156 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 16157 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16158 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16159 | { } /* end */ |
| 16160 | }; |
| 16161 | |
| 16162 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 16163 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16164 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16165 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16166 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 16167 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16168 | |
| 16169 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16170 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16171 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16172 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16173 | { } /* end */ |
| 16174 | }; |
| 16175 | |
| 16176 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 16177 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16178 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16179 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16180 | |
| 16181 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16182 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16183 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16184 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16185 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16186 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16187 | { } /* end */ |
| 16188 | }; |
| 16189 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16190 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 16191 | .ops = &snd_hda_bind_sw, |
| 16192 | .values = { |
| 16193 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16194 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 16195 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 16196 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 16197 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 16198 | 0 |
| 16199 | }, |
| 16200 | }; |
| 16201 | |
| 16202 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
| 16203 | .ops = &snd_hda_bind_sw, |
| 16204 | .values = { |
| 16205 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16206 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 16207 | 0 |
| 16208 | }, |
| 16209 | }; |
| 16210 | |
| 16211 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { |
| 16212 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 16213 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 16214 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 16215 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16216 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16217 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16218 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16219 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16220 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16221 | { } /* end */ |
| 16222 | }; |
| 16223 | |
| 16224 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 16225 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 16226 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 16227 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 16228 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 16229 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16230 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16231 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16232 | { } /* end */ |
| 16233 | }; |
| 16234 | |
| 16235 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16236 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 16237 | { |
| 16238 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16239 | .name = "Channel Mode", |
| 16240 | .info = alc_ch_mode_info, |
| 16241 | .get = alc_ch_mode_get, |
| 16242 | .put = alc_ch_mode_put, |
| 16243 | }, |
| 16244 | { } /* end */ |
| 16245 | }; |
| 16246 | |
| 16247 | static struct hda_verb alc662_init_verbs[] = { |
| 16248 | /* ADC: mute amp left and right */ |
| 16249 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16250 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16251 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 16252 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16253 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16254 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16255 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16256 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16257 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16258 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16259 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16260 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16261 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16262 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16263 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16264 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16265 | |
| 16266 | /* Front Pin: output 0 (0x0c) */ |
| 16267 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16268 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16269 | |
| 16270 | /* Rear Pin: output 1 (0x0d) */ |
| 16271 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16272 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16273 | |
| 16274 | /* CLFE Pin: output 2 (0x0e) */ |
| 16275 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16276 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16277 | |
| 16278 | /* Mic (rear) pin: input vref at 80% */ |
| 16279 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16280 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16281 | /* Front Mic pin: input vref at 80% */ |
| 16282 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16283 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16284 | /* Line In pin: input */ |
| 16285 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16286 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16287 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16288 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16289 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16290 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16291 | /* CD pin widget for input */ |
| 16292 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16293 | |
| 16294 | /* FIXME: use matrix-type input source selection */ |
| 16295 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 16296 | /* Input mixer */ |
| 16297 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16298 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16299 | |
| 16300 | /* always trun on EAPD */ |
| 16301 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16302 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16303 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16304 | { } |
| 16305 | }; |
| 16306 | |
| 16307 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 16308 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16309 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16310 | {} |
| 16311 | }; |
| 16312 | |
| 16313 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 16314 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16315 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16316 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16317 | }; |
| 16318 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16319 | /* Set Unsolicited Event*/ |
| 16320 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 16321 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16322 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16323 | {} |
| 16324 | }; |
| 16325 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16326 | /* |
| 16327 | * generic initialization of ADC, input mixers and output mixers |
| 16328 | */ |
| 16329 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 16330 | /* |
| 16331 | * Unmute ADC and set the default input to mic-in |
| 16332 | */ |
| 16333 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16334 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16335 | |
| 16336 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 16337 | * mixer widget |
| 16338 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 16339 | * panel mic (mic 2) |
| 16340 | */ |
| 16341 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16342 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16343 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16344 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16345 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16346 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16347 | |
| 16348 | /* |
| 16349 | * Set up output mixers (0x0c - 0x0f) |
| 16350 | */ |
| 16351 | /* set vol=0 to output mixers */ |
| 16352 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16353 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16354 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16355 | |
| 16356 | /* set up input amps for analog loopback */ |
| 16357 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16358 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16359 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16360 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16361 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16362 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16363 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16364 | |
| 16365 | |
| 16366 | /* FIXME: use matrix-type input source selection */ |
| 16367 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 16368 | /* Input mixer */ |
| 16369 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16370 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16371 | { } |
| 16372 | }; |
| 16373 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16374 | /* additional verbs for ALC663 */ |
| 16375 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 16376 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16377 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16378 | { } |
| 16379 | }; |
| 16380 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16381 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16382 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16383 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16384 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16385 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16386 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16387 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16388 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16389 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16390 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16391 | {} |
| 16392 | }; |
| 16393 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16394 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 16395 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16396 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16397 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16398 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16399 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16400 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16401 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16402 | {} |
| 16403 | }; |
| 16404 | |
| 16405 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 16406 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16407 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16408 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16409 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16410 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16411 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16412 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16413 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16414 | {} |
| 16415 | }; |
| 16416 | |
| 16417 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 16418 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16419 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16420 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16421 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16422 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16423 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16424 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16425 | {} |
| 16426 | }; |
| 16427 | |
| 16428 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 16429 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16430 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16431 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16432 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16433 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16434 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16435 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16436 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16437 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16438 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16439 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16440 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16441 | {} |
| 16442 | }; |
| 16443 | |
| 16444 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 16445 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16446 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16447 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16448 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16449 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16450 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16451 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16452 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16453 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16454 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16455 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16456 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16457 | {} |
| 16458 | }; |
| 16459 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16460 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 16461 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16462 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 16463 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 16464 | |
| 16465 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16466 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16467 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16468 | |
| 16469 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16470 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 16471 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 16472 | {} |
| 16473 | }; |
| 16474 | |
| 16475 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 16476 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16477 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16478 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16479 | |
| 16480 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16481 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16482 | {} |
| 16483 | }; |
| 16484 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16485 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 16486 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 16487 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16488 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16489 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16490 | {} |
| 16491 | }; |
| 16492 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16493 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 16494 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16495 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16496 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16497 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16498 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16499 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16500 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16501 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16502 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16503 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16504 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16505 | {} |
| 16506 | }; |
| 16507 | |
| 16508 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 16509 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16510 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16511 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16512 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16513 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16514 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16515 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16516 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16517 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16518 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16519 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16520 | {} |
| 16521 | }; |
| 16522 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16523 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 16524 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16525 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16526 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16527 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16528 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16529 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16530 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16531 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16532 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16533 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16534 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16535 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16536 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16537 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16538 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16539 | {} |
| 16540 | }; |
| 16541 | |
| 16542 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 16543 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16544 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16545 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16546 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16547 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16548 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16549 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16550 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16551 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16552 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16553 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16554 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16555 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16556 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16557 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16558 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16559 | {} |
| 16560 | }; |
| 16561 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16562 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 16563 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 16564 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 16565 | { } /* end */ |
| 16566 | }; |
| 16567 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16568 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 16569 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 16570 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 16571 | { } /* end */ |
| 16572 | }; |
| 16573 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16574 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 16575 | { |
| 16576 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16577 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16578 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16579 | present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16580 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16581 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16582 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16583 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16584 | } |
| 16585 | |
| 16586 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 16587 | { |
| 16588 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16589 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16590 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16591 | present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16592 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16593 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16594 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16595 | HDA_AMP_MUTE, bits); |
| 16596 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16597 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16598 | } |
| 16599 | |
| 16600 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 16601 | unsigned int res) |
| 16602 | { |
| 16603 | if ((res >> 26) == ALC880_HP_EVENT) |
| 16604 | alc662_lenovo_101e_all_automute(codec); |
| 16605 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 16606 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 16607 | } |
| 16608 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16609 | /* unsolicited event for HP jack sensing */ |
| 16610 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 16611 | unsigned int res) |
| 16612 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16613 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16614 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16615 | else |
| 16616 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16617 | } |
| 16618 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16619 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16620 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16621 | struct alc_spec *spec = codec->spec; |
| 16622 | |
| 16623 | alc262_hippo1_setup(codec); |
| 16624 | spec->ext_mic.pin = 0x18; |
| 16625 | spec->ext_mic.mux_idx = 0; |
| 16626 | spec->int_mic.pin = 0x19; |
| 16627 | spec->int_mic.mux_idx = 1; |
| 16628 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16629 | } |
| 16630 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16631 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 16632 | { |
| 16633 | alc262_hippo_automute(codec); |
| 16634 | alc_mic_automute(codec); |
| 16635 | } |
| 16636 | |
| 16637 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16638 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16639 | struct alc_spec *spec = codec->spec; |
| 16640 | |
| 16641 | spec->autocfg.hp_pins[0] = 0x14; |
| 16642 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16643 | } |
| 16644 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16645 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 16646 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16647 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 16648 | { |
| 16649 | unsigned int present; |
| 16650 | unsigned char bits; |
| 16651 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16652 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16653 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16654 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16655 | AMP_IN_MUTE(0), bits); |
| 16656 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16657 | AMP_IN_MUTE(0), bits); |
| 16658 | } |
| 16659 | |
| 16660 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 16661 | { |
| 16662 | unsigned int present; |
| 16663 | unsigned char bits; |
| 16664 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16665 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16666 | bits = present ? HDA_AMP_MUTE : 0; |
| 16667 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16668 | AMP_IN_MUTE(0), bits); |
| 16669 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16670 | AMP_IN_MUTE(0), bits); |
| 16671 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16672 | AMP_IN_MUTE(0), bits); |
| 16673 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16674 | AMP_IN_MUTE(0), bits); |
| 16675 | } |
| 16676 | |
| 16677 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 16678 | { |
| 16679 | unsigned int present; |
| 16680 | unsigned char bits; |
| 16681 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16682 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16683 | bits = present ? HDA_AMP_MUTE : 0; |
| 16684 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16685 | AMP_IN_MUTE(0), bits); |
| 16686 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16687 | AMP_IN_MUTE(0), bits); |
| 16688 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16689 | AMP_IN_MUTE(0), bits); |
| 16690 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16691 | AMP_IN_MUTE(0), bits); |
| 16692 | } |
| 16693 | |
| 16694 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 16695 | { |
| 16696 | unsigned int present; |
| 16697 | unsigned char bits; |
| 16698 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16699 | present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16700 | bits = present ? 0 : PIN_OUT; |
| 16701 | snd_hda_codec_write(codec, 0x14, 0, |
| 16702 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 16703 | } |
| 16704 | |
| 16705 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 16706 | { |
| 16707 | unsigned int present1, present2; |
| 16708 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16709 | present1 = snd_hda_jack_detect(codec, 0x21); |
| 16710 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16711 | |
| 16712 | if (present1 || present2) { |
| 16713 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16714 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16715 | } else { |
| 16716 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16717 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16718 | } |
| 16719 | } |
| 16720 | |
| 16721 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 16722 | { |
| 16723 | unsigned int present1, present2; |
| 16724 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16725 | present1 = snd_hda_jack_detect(codec, 0x1b); |
| 16726 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16727 | |
| 16728 | if (present1 || present2) { |
| 16729 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16730 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16731 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16732 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16733 | } else { |
| 16734 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16735 | AMP_IN_MUTE(0), 0); |
| 16736 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16737 | AMP_IN_MUTE(0), 0); |
| 16738 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16739 | } |
| 16740 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16741 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
| 16742 | { |
| 16743 | unsigned int present1, present2; |
| 16744 | |
| 16745 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 16746 | AC_VERB_GET_PIN_SENSE, 0) |
| 16747 | & AC_PINSENSE_PRESENCE; |
| 16748 | present2 = snd_hda_codec_read(codec, 0x21, 0, |
| 16749 | AC_VERB_GET_PIN_SENSE, 0) |
| 16750 | & AC_PINSENSE_PRESENCE; |
| 16751 | |
| 16752 | if (present1 || present2) { |
| 16753 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16754 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16755 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 16756 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16757 | } else { |
| 16758 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16759 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16760 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 16761 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16762 | } |
| 16763 | } |
| 16764 | |
| 16765 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) |
| 16766 | { |
| 16767 | unsigned int present1, present2; |
| 16768 | |
| 16769 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 16770 | AC_VERB_GET_PIN_SENSE, 0) |
| 16771 | & AC_PINSENSE_PRESENCE; |
| 16772 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16773 | AC_VERB_GET_PIN_SENSE, 0) |
| 16774 | & AC_PINSENSE_PRESENCE; |
| 16775 | |
| 16776 | if (present1 || present2) { |
| 16777 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16778 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16779 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 16780 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16781 | } else { |
| 16782 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16783 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16784 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 16785 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16786 | } |
| 16787 | } |
| 16788 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16789 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 16790 | unsigned int res) |
| 16791 | { |
| 16792 | switch (res >> 26) { |
| 16793 | case ALC880_HP_EVENT: |
| 16794 | alc663_m51va_speaker_automute(codec); |
| 16795 | break; |
| 16796 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16797 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16798 | break; |
| 16799 | } |
| 16800 | } |
| 16801 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16802 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 16803 | { |
| 16804 | struct alc_spec *spec = codec->spec; |
| 16805 | spec->ext_mic.pin = 0x18; |
| 16806 | spec->ext_mic.mux_idx = 0; |
| 16807 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16808 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16809 | spec->auto_mic = 1; |
| 16810 | } |
| 16811 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16812 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 16813 | { |
| 16814 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16815 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16816 | } |
| 16817 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16818 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16819 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16820 | |
| 16821 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 16822 | { |
| 16823 | struct alc_spec *spec = codec->spec; |
| 16824 | spec->ext_mic.pin = 0x18; |
| 16825 | spec->ext_mic.mux_idx = 0; |
| 16826 | spec->int_mic.pin = 0x19; |
| 16827 | spec->int_mic.mux_idx = 1; |
| 16828 | spec->auto_mic = 1; |
| 16829 | } |
| 16830 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16831 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16832 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16833 | /* ***************** Mode2 ******************************/ |
| 16834 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 16835 | unsigned int res) |
| 16836 | { |
| 16837 | switch (res >> 26) { |
| 16838 | case ALC880_HP_EVENT: |
| 16839 | alc662_f5z_speaker_automute(codec); |
| 16840 | break; |
| 16841 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16842 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16843 | break; |
| 16844 | } |
| 16845 | } |
| 16846 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16847 | #define alc662_mode2_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16848 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16849 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 16850 | { |
| 16851 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16852 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16853 | } |
| 16854 | /* ***************** Mode3 ******************************/ |
| 16855 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 16856 | unsigned int res) |
| 16857 | { |
| 16858 | switch (res >> 26) { |
| 16859 | case ALC880_HP_EVENT: |
| 16860 | alc663_two_hp_m1_speaker_automute(codec); |
| 16861 | break; |
| 16862 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16863 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16864 | break; |
| 16865 | } |
| 16866 | } |
| 16867 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16868 | #define alc663_mode3_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16869 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16870 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 16871 | { |
| 16872 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16873 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16874 | } |
| 16875 | /* ***************** Mode4 ******************************/ |
| 16876 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 16877 | unsigned int res) |
| 16878 | { |
| 16879 | switch (res >> 26) { |
| 16880 | case ALC880_HP_EVENT: |
| 16881 | alc663_21jd_two_speaker_automute(codec); |
| 16882 | break; |
| 16883 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16884 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16885 | break; |
| 16886 | } |
| 16887 | } |
| 16888 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16889 | #define alc663_mode4_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16890 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16891 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 16892 | { |
| 16893 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16894 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16895 | } |
| 16896 | /* ***************** Mode5 ******************************/ |
| 16897 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 16898 | unsigned int res) |
| 16899 | { |
| 16900 | switch (res >> 26) { |
| 16901 | case ALC880_HP_EVENT: |
| 16902 | alc663_15jd_two_speaker_automute(codec); |
| 16903 | break; |
| 16904 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16905 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16906 | break; |
| 16907 | } |
| 16908 | } |
| 16909 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16910 | #define alc663_mode5_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16911 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16912 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 16913 | { |
| 16914 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16915 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16916 | } |
| 16917 | /* ***************** Mode6 ******************************/ |
| 16918 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 16919 | unsigned int res) |
| 16920 | { |
| 16921 | switch (res >> 26) { |
| 16922 | case ALC880_HP_EVENT: |
| 16923 | alc663_two_hp_m2_speaker_automute(codec); |
| 16924 | break; |
| 16925 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16926 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16927 | break; |
| 16928 | } |
| 16929 | } |
| 16930 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16931 | #define alc663_mode6_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16932 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16933 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 16934 | { |
| 16935 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16936 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16937 | } |
| 16938 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16939 | /* ***************** Mode7 ******************************/ |
| 16940 | static void alc663_mode7_unsol_event(struct hda_codec *codec, |
| 16941 | unsigned int res) |
| 16942 | { |
| 16943 | switch (res >> 26) { |
| 16944 | case ALC880_HP_EVENT: |
| 16945 | alc663_two_hp_m7_speaker_automute(codec); |
| 16946 | break; |
| 16947 | case ALC880_MIC_EVENT: |
| 16948 | alc_mic_automute(codec); |
| 16949 | break; |
| 16950 | } |
| 16951 | } |
| 16952 | |
| 16953 | #define alc663_mode7_setup alc663_mode1_setup |
| 16954 | |
| 16955 | static void alc663_mode7_inithook(struct hda_codec *codec) |
| 16956 | { |
| 16957 | alc663_two_hp_m7_speaker_automute(codec); |
| 16958 | alc_mic_automute(codec); |
| 16959 | } |
| 16960 | |
| 16961 | /* ***************** Mode8 ******************************/ |
| 16962 | static void alc663_mode8_unsol_event(struct hda_codec *codec, |
| 16963 | unsigned int res) |
| 16964 | { |
| 16965 | switch (res >> 26) { |
| 16966 | case ALC880_HP_EVENT: |
| 16967 | alc663_two_hp_m8_speaker_automute(codec); |
| 16968 | break; |
| 16969 | case ALC880_MIC_EVENT: |
| 16970 | alc_mic_automute(codec); |
| 16971 | break; |
| 16972 | } |
| 16973 | } |
| 16974 | |
| 16975 | #define alc663_mode8_setup alc663_m51va_setup |
| 16976 | |
| 16977 | static void alc663_mode8_inithook(struct hda_codec *codec) |
| 16978 | { |
| 16979 | alc663_two_hp_m8_speaker_automute(codec); |
| 16980 | alc_mic_automute(codec); |
| 16981 | } |
| 16982 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16983 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 16984 | { |
| 16985 | unsigned int present; |
| 16986 | unsigned char bits; |
| 16987 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16988 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16989 | bits = present ? HDA_AMP_MUTE : 0; |
| 16990 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16991 | HDA_AMP_MUTE, bits); |
| 16992 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16993 | HDA_AMP_MUTE, bits); |
| 16994 | } |
| 16995 | |
| 16996 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 16997 | { |
| 16998 | unsigned int present; |
| 16999 | unsigned char bits; |
| 17000 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17001 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17002 | bits = present ? HDA_AMP_MUTE : 0; |
| 17003 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17004 | HDA_AMP_MUTE, bits); |
| 17005 | } |
| 17006 | |
| 17007 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 17008 | unsigned int res) |
| 17009 | { |
| 17010 | switch (res >> 26) { |
| 17011 | case ALC880_HP_EVENT: |
| 17012 | alc663_g71v_hp_automute(codec); |
| 17013 | break; |
| 17014 | case ALC880_FRONT_EVENT: |
| 17015 | alc663_g71v_front_automute(codec); |
| 17016 | break; |
| 17017 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17018 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17019 | break; |
| 17020 | } |
| 17021 | } |
| 17022 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17023 | #define alc663_g71v_setup alc663_m51va_setup |
| 17024 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17025 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 17026 | { |
| 17027 | alc663_g71v_front_automute(codec); |
| 17028 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17029 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17030 | } |
| 17031 | |
| 17032 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 17033 | unsigned int res) |
| 17034 | { |
| 17035 | switch (res >> 26) { |
| 17036 | case ALC880_HP_EVENT: |
| 17037 | alc663_m51va_speaker_automute(codec); |
| 17038 | break; |
| 17039 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17040 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17041 | break; |
| 17042 | } |
| 17043 | } |
| 17044 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17045 | #define alc663_g50v_setup alc663_m51va_setup |
| 17046 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17047 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 17048 | { |
| 17049 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17050 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17051 | } |
| 17052 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17053 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 17054 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17055 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17056 | |
| 17057 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 17058 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17059 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17060 | |
| 17061 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 17062 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17063 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17064 | { } /* end */ |
| 17065 | }; |
| 17066 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17067 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 17068 | /* Master Playback automatically created from Speaker and Headphone */ |
| 17069 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17070 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17071 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17072 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17073 | |
| 17074 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17075 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17076 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 17077 | |
| 17078 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17079 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17080 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 17081 | { } /* end */ |
| 17082 | }; |
| 17083 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17084 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17085 | #define alc662_loopbacks alc880_loopbacks |
| 17086 | #endif |
| 17087 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17088 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 17089 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17090 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 17091 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 17092 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 17093 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 17094 | |
| 17095 | /* |
| 17096 | * configuration and preset |
| 17097 | */ |
| 17098 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 17099 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 17100 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 17101 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 17102 | [ALC662_5ST_DIG] = "6stack-dig", |
| 17103 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 17104 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17105 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17106 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17107 | [ALC663_ASUS_M51VA] = "m51va", |
| 17108 | [ALC663_ASUS_G71V] = "g71v", |
| 17109 | [ALC663_ASUS_H13] = "h13", |
| 17110 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17111 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 17112 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 17113 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 17114 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 17115 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 17116 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17117 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 17118 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 17119 | [ALC272_DELL] = "dell", |
| 17120 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17121 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17122 | [ALC662_AUTO] = "auto", |
| 17123 | }; |
| 17124 | |
| 17125 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17126 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17127 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 17128 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17129 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 17130 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 17131 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 17132 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 17133 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 17134 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17135 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 17136 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17137 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17138 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 17139 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 17140 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 17141 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 17142 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17143 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17144 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 17145 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17146 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 17147 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 17148 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 17149 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17150 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17151 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 17152 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 17153 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17154 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 17155 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 17156 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 17157 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17158 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17159 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 17160 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17161 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17162 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 17163 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 17164 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17165 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
| 17166 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 17167 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17168 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 17169 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 17170 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17171 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17172 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 17173 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17174 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17175 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 17176 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17177 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 17178 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 17179 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17180 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17181 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 17182 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 17183 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17184 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17185 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17186 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 17187 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 17188 | ALC662_3ST_6ch_DIG), |
Manoj Iyer | 3db6c03 | 2009-09-22 18:33:29 -0500 | [diff] [blame] | 17189 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17190 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 17191 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 17192 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 17193 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 17194 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17195 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 17196 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 17197 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17198 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 17199 | ALC663_ASUS_H13), |
David Santinoli | 7aee674 | 2009-12-09 12:34:26 +0100 | [diff] [blame] | 17200 | SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17201 | {} |
| 17202 | }; |
| 17203 | |
| 17204 | static struct alc_config_preset alc662_presets[] = { |
| 17205 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17206 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17207 | .init_verbs = { alc662_init_verbs }, |
| 17208 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17209 | .dac_nids = alc662_dac_nids, |
| 17210 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17211 | .dig_in_nid = ALC662_DIGIN_NID, |
| 17212 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17213 | .channel_mode = alc662_3ST_2ch_modes, |
| 17214 | .input_mux = &alc662_capture_source, |
| 17215 | }, |
| 17216 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17217 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17218 | .init_verbs = { alc662_init_verbs }, |
| 17219 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17220 | .dac_nids = alc662_dac_nids, |
| 17221 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17222 | .dig_in_nid = ALC662_DIGIN_NID, |
| 17223 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 17224 | .channel_mode = alc662_3ST_6ch_modes, |
| 17225 | .need_dac_fix = 1, |
| 17226 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17227 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17228 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17229 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17230 | .init_verbs = { alc662_init_verbs }, |
| 17231 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17232 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17233 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 17234 | .channel_mode = alc662_3ST_6ch_modes, |
| 17235 | .need_dac_fix = 1, |
| 17236 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17237 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17238 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17239 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17240 | .init_verbs = { alc662_init_verbs }, |
| 17241 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17242 | .dac_nids = alc662_dac_nids, |
| 17243 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17244 | .dig_in_nid = ALC662_DIGIN_NID, |
| 17245 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 17246 | .channel_mode = alc662_5stack_modes, |
| 17247 | .input_mux = &alc662_capture_source, |
| 17248 | }, |
| 17249 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17250 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17251 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 17252 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17253 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17254 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17255 | .channel_mode = alc662_3ST_2ch_modes, |
| 17256 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 17257 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 17258 | .init_hook = alc662_lenovo_101e_all_automute, |
| 17259 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17260 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17261 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17262 | .init_verbs = { alc662_init_verbs, |
| 17263 | alc662_eeepc_sue_init_verbs }, |
| 17264 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17265 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17266 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17267 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17268 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17269 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17270 | .init_hook = alc662_eeepc_inithook, |
| 17271 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17272 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17273 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17274 | alc662_chmode_mixer }, |
| 17275 | .init_verbs = { alc662_init_verbs, |
| 17276 | alc662_eeepc_ep20_sue_init_verbs }, |
| 17277 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17278 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17279 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 17280 | .channel_mode = alc662_3ST_6ch_modes, |
| 17281 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17282 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17283 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17284 | .init_hook = alc662_eeepc_ep20_inithook, |
| 17285 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17286 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17287 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17288 | .init_verbs = { alc662_init_verbs, |
| 17289 | alc662_ecs_init_verbs }, |
| 17290 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17291 | .dac_nids = alc662_dac_nids, |
| 17292 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17293 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17294 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17295 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17296 | .init_hook = alc662_eeepc_inithook, |
| 17297 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17298 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17299 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17300 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 17301 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17302 | .dac_nids = alc662_dac_nids, |
| 17303 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17304 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17305 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17306 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17307 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17308 | .init_hook = alc663_m51va_inithook, |
| 17309 | }, |
| 17310 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17311 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17312 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 17313 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17314 | .dac_nids = alc662_dac_nids, |
| 17315 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17316 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17317 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17318 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17319 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17320 | .init_hook = alc663_g71v_inithook, |
| 17321 | }, |
| 17322 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17323 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17324 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 17325 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17326 | .dac_nids = alc662_dac_nids, |
| 17327 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17328 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17329 | .unsol_event = alc663_m51va_unsol_event, |
| 17330 | .init_hook = alc663_m51va_inithook, |
| 17331 | }, |
| 17332 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17333 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17334 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 17335 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17336 | .dac_nids = alc662_dac_nids, |
| 17337 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17338 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 17339 | .channel_mode = alc662_3ST_6ch_modes, |
| 17340 | .input_mux = &alc663_capture_source, |
| 17341 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17342 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17343 | .init_hook = alc663_g50v_inithook, |
| 17344 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17345 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17346 | .mixers = { alc663_m51va_mixer }, |
| 17347 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17348 | .init_verbs = { alc662_init_verbs, |
| 17349 | alc663_21jd_amic_init_verbs }, |
| 17350 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17351 | .hp_nid = 0x03, |
| 17352 | .dac_nids = alc662_dac_nids, |
| 17353 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17354 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17355 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17356 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17357 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17358 | .init_hook = alc663_mode1_inithook, |
| 17359 | }, |
| 17360 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17361 | .mixers = { alc662_1bjd_mixer }, |
| 17362 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17363 | .init_verbs = { alc662_init_verbs, |
| 17364 | alc662_1bjd_amic_init_verbs }, |
| 17365 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17366 | .dac_nids = alc662_dac_nids, |
| 17367 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17368 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17369 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17370 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17371 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17372 | .init_hook = alc662_mode2_inithook, |
| 17373 | }, |
| 17374 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17375 | .mixers = { alc663_two_hp_m1_mixer }, |
| 17376 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17377 | .init_verbs = { alc662_init_verbs, |
| 17378 | alc663_two_hp_amic_m1_init_verbs }, |
| 17379 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17380 | .hp_nid = 0x03, |
| 17381 | .dac_nids = alc662_dac_nids, |
| 17382 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17383 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17384 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17385 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17386 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17387 | .init_hook = alc663_mode3_inithook, |
| 17388 | }, |
| 17389 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17390 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 17391 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17392 | .init_verbs = { alc662_init_verbs, |
| 17393 | alc663_21jd_amic_init_verbs}, |
| 17394 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17395 | .hp_nid = 0x03, |
| 17396 | .dac_nids = alc662_dac_nids, |
| 17397 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17398 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17399 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17400 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17401 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17402 | .init_hook = alc663_mode4_inithook, |
| 17403 | }, |
| 17404 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17405 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 17406 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17407 | .init_verbs = { alc662_init_verbs, |
| 17408 | alc663_15jd_amic_init_verbs }, |
| 17409 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17410 | .hp_nid = 0x03, |
| 17411 | .dac_nids = alc662_dac_nids, |
| 17412 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17413 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17414 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17415 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17416 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17417 | .init_hook = alc663_mode5_inithook, |
| 17418 | }, |
| 17419 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17420 | .mixers = { alc663_two_hp_m2_mixer }, |
| 17421 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17422 | .init_verbs = { alc662_init_verbs, |
| 17423 | alc663_two_hp_amic_m2_init_verbs }, |
| 17424 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17425 | .hp_nid = 0x03, |
| 17426 | .dac_nids = alc662_dac_nids, |
| 17427 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17428 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17429 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17430 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17431 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17432 | .init_hook = alc663_mode6_inithook, |
| 17433 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17434 | [ALC663_ASUS_MODE7] = { |
| 17435 | .mixers = { alc663_mode7_mixer }, |
| 17436 | .cap_mixer = alc662_auto_capture_mixer, |
| 17437 | .init_verbs = { alc662_init_verbs, |
| 17438 | alc663_mode7_init_verbs }, |
| 17439 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17440 | .hp_nid = 0x03, |
| 17441 | .dac_nids = alc662_dac_nids, |
| 17442 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17443 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17444 | .channel_mode = alc662_3ST_2ch_modes, |
| 17445 | .unsol_event = alc663_mode7_unsol_event, |
| 17446 | .setup = alc663_mode7_setup, |
| 17447 | .init_hook = alc663_mode7_inithook, |
| 17448 | }, |
| 17449 | [ALC663_ASUS_MODE8] = { |
| 17450 | .mixers = { alc663_mode8_mixer }, |
| 17451 | .cap_mixer = alc662_auto_capture_mixer, |
| 17452 | .init_verbs = { alc662_init_verbs, |
| 17453 | alc663_mode8_init_verbs }, |
| 17454 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17455 | .hp_nid = 0x03, |
| 17456 | .dac_nids = alc662_dac_nids, |
| 17457 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17458 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17459 | .channel_mode = alc662_3ST_2ch_modes, |
| 17460 | .unsol_event = alc663_mode8_unsol_event, |
| 17461 | .setup = alc663_mode8_setup, |
| 17462 | .init_hook = alc663_mode8_inithook, |
| 17463 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17464 | [ALC272_DELL] = { |
| 17465 | .mixers = { alc663_m51va_mixer }, |
| 17466 | .cap_mixer = alc272_auto_capture_mixer, |
| 17467 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 17468 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17469 | .dac_nids = alc662_dac_nids, |
| 17470 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17471 | .adc_nids = alc272_adc_nids, |
| 17472 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 17473 | .capsrc_nids = alc272_capsrc_nids, |
| 17474 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17475 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17476 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17477 | .init_hook = alc663_m51va_inithook, |
| 17478 | }, |
| 17479 | [ALC272_DELL_ZM1] = { |
| 17480 | .mixers = { alc663_m51va_mixer }, |
| 17481 | .cap_mixer = alc662_auto_capture_mixer, |
| 17482 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 17483 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17484 | .dac_nids = alc662_dac_nids, |
| 17485 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17486 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17487 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17488 | .capsrc_nids = alc662_capsrc_nids, |
| 17489 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17490 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17491 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17492 | .init_hook = alc663_m51va_inithook, |
| 17493 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17494 | [ALC272_SAMSUNG_NC10] = { |
| 17495 | .mixers = { alc272_nc10_mixer }, |
| 17496 | .init_verbs = { alc662_init_verbs, |
| 17497 | alc663_21jd_amic_init_verbs }, |
| 17498 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17499 | .dac_nids = alc272_dac_nids, |
| 17500 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17501 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17502 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17503 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17504 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17505 | .init_hook = alc663_mode4_inithook, |
| 17506 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17507 | }; |
| 17508 | |
| 17509 | |
| 17510 | /* |
| 17511 | * BIOS auto configuration |
| 17512 | */ |
| 17513 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17514 | /* convert from MIX nid to DAC */ |
| 17515 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
| 17516 | { |
| 17517 | if (nid == 0x0f) |
| 17518 | return 0x02; |
| 17519 | else if (nid >= 0x0c && nid <= 0x0e) |
| 17520 | return nid - 0x0c + 0x02; |
| 17521 | else |
| 17522 | return 0; |
| 17523 | } |
| 17524 | |
| 17525 | /* get MIX nid connected to the given pin targeted to DAC */ |
| 17526 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
| 17527 | hda_nid_t dac) |
| 17528 | { |
| 17529 | hda_nid_t mix[4]; |
| 17530 | int i, num; |
| 17531 | |
| 17532 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 17533 | for (i = 0; i < num; i++) { |
| 17534 | if (alc662_mix_to_dac(mix[i]) == dac) |
| 17535 | return mix[i]; |
| 17536 | } |
| 17537 | return 0; |
| 17538 | } |
| 17539 | |
| 17540 | /* look for an empty DAC slot */ |
| 17541 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 17542 | { |
| 17543 | struct alc_spec *spec = codec->spec; |
| 17544 | hda_nid_t srcs[5]; |
| 17545 | int i, j, num; |
| 17546 | |
| 17547 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
| 17548 | if (num < 0) |
| 17549 | return 0; |
| 17550 | for (i = 0; i < num; i++) { |
| 17551 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); |
| 17552 | if (!nid) |
| 17553 | continue; |
| 17554 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 17555 | if (spec->multiout.dac_nids[j] == nid) |
| 17556 | break; |
| 17557 | if (j >= spec->multiout.num_dacs) |
| 17558 | return nid; |
| 17559 | } |
| 17560 | return 0; |
| 17561 | } |
| 17562 | |
| 17563 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 17564 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 17565 | const struct auto_pin_cfg *cfg) |
| 17566 | { |
| 17567 | struct alc_spec *spec = codec->spec; |
| 17568 | int i; |
| 17569 | hda_nid_t dac; |
| 17570 | |
| 17571 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 17572 | for (i = 0; i < cfg->line_outs; i++) { |
| 17573 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); |
| 17574 | if (!dac) |
| 17575 | continue; |
| 17576 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 17577 | } |
| 17578 | return 0; |
| 17579 | } |
| 17580 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17581 | 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] | 17582 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17583 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17584 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17585 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 17586 | } |
| 17587 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17588 | 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] | 17589 | hda_nid_t nid, unsigned int chs) |
| 17590 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17591 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17592 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 17593 | } |
| 17594 | |
| 17595 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 17596 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 17597 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 17598 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 17599 | |
| 17600 | /* add playback controls from the parsed DAC table */ |
| 17601 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 17602 | const struct auto_pin_cfg *cfg) |
| 17603 | { |
| 17604 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17605 | static const char *chname[4] = { |
| 17606 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 17607 | }; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17608 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17609 | int i, err; |
| 17610 | |
| 17611 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17612 | nid = spec->multiout.dac_nids[i]; |
| 17613 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17614 | continue; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17615 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); |
| 17616 | if (!mix) |
| 17617 | continue; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17618 | if (i == 2) { |
| 17619 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17620 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17621 | if (err < 0) |
| 17622 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17623 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17624 | if (err < 0) |
| 17625 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17626 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17627 | if (err < 0) |
| 17628 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17629 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17630 | if (err < 0) |
| 17631 | return err; |
| 17632 | } else { |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 17633 | const char *pfx; |
| 17634 | if (cfg->line_outs == 1 && |
| 17635 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17636 | if (cfg->hp_outs) |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 17637 | pfx = "Speaker"; |
| 17638 | else |
| 17639 | pfx = "PCM"; |
| 17640 | } else |
| 17641 | pfx = chname[i]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17642 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17643 | if (err < 0) |
| 17644 | return err; |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 17645 | if (cfg->line_outs == 1 && |
| 17646 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 17647 | pfx = "Speaker"; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17648 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17649 | if (err < 0) |
| 17650 | return err; |
| 17651 | } |
| 17652 | } |
| 17653 | return 0; |
| 17654 | } |
| 17655 | |
| 17656 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17657 | /* return DAC nid if any new DAC is assigned */ |
| 17658 | 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] | 17659 | const char *pfx) |
| 17660 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17661 | struct alc_spec *spec = codec->spec; |
| 17662 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17663 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17664 | |
| 17665 | if (!pin) |
| 17666 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17667 | nid = alc662_look_for_dac(codec, pin); |
| 17668 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17669 | /* the corresponding DAC is already occupied */ |
| 17670 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 17671 | return 0; /* no way */ |
| 17672 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17673 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17674 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17675 | } |
| 17676 | |
| 17677 | mix = alc662_dac_to_mix(codec, pin, nid); |
| 17678 | if (!mix) |
| 17679 | return 0; |
| 17680 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 17681 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17682 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17683 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 17684 | if (err < 0) |
| 17685 | return err; |
| 17686 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17687 | } |
| 17688 | |
| 17689 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17690 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 17691 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17692 | |
| 17693 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 17694 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17695 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17696 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17697 | int i, num; |
| 17698 | hda_nid_t srcs[4]; |
| 17699 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17700 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17701 | /* need the manual connection? */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17702 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
| 17703 | if (num <= 1) |
| 17704 | return; |
| 17705 | for (i = 0; i < num; i++) { |
| 17706 | if (alc662_mix_to_dac(srcs[i]) != dac) |
| 17707 | continue; |
| 17708 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); |
| 17709 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17710 | } |
| 17711 | } |
| 17712 | |
| 17713 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 17714 | { |
| 17715 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17716 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17717 | int i; |
| 17718 | |
| 17719 | for (i = 0; i <= HDA_SIDE; i++) { |
| 17720 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 17721 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17722 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17723 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17724 | } |
| 17725 | } |
| 17726 | |
| 17727 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 17728 | { |
| 17729 | struct alc_spec *spec = codec->spec; |
| 17730 | hda_nid_t pin; |
| 17731 | |
| 17732 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17733 | if (pin) |
| 17734 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 17735 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17736 | pin = spec->autocfg.speaker_pins[0]; |
| 17737 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17738 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 17739 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17740 | } |
| 17741 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17742 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 17743 | |
| 17744 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 17745 | { |
| 17746 | struct alc_spec *spec = codec->spec; |
| 17747 | int i; |
| 17748 | |
| 17749 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 17750 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17751 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 17752 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 17753 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17754 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17755 | snd_hda_codec_write(codec, nid, 0, |
| 17756 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17757 | AMP_OUT_MUTE); |
| 17758 | } |
| 17759 | } |
| 17760 | } |
| 17761 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17762 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 17763 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17764 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 17765 | { |
| 17766 | struct alc_spec *spec = codec->spec; |
| 17767 | int err; |
| 17768 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 17769 | |
| 17770 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17771 | alc662_ignore); |
| 17772 | if (err < 0) |
| 17773 | return err; |
| 17774 | if (!spec->autocfg.line_outs) |
| 17775 | return 0; /* can't find valid BIOS pin config */ |
| 17776 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17777 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17778 | if (err < 0) |
| 17779 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17780 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17781 | if (err < 0) |
| 17782 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17783 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17784 | spec->autocfg.speaker_pins[0], |
| 17785 | "Speaker"); |
| 17786 | if (err < 0) |
| 17787 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17788 | if (err) |
| 17789 | spec->multiout.extra_out_nid[0] = err; |
| 17790 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17791 | "Headphone"); |
| 17792 | if (err < 0) |
| 17793 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17794 | if (err) |
| 17795 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17796 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17797 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17798 | return err; |
| 17799 | |
| 17800 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17801 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 17802 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17803 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 17804 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17805 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17806 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17807 | |
| 17808 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17809 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 17810 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17811 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17812 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17813 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 17814 | |
| 17815 | err = alc_auto_add_mic_boost(codec); |
| 17816 | if (err < 0) |
| 17817 | return err; |
| 17818 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17819 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 17820 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17821 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17822 | } |
| 17823 | |
| 17824 | /* additional initialization for auto-configuration model */ |
| 17825 | static void alc662_auto_init(struct hda_codec *codec) |
| 17826 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17827 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17828 | alc662_auto_init_multi_out(codec); |
| 17829 | alc662_auto_init_hp_out(codec); |
| 17830 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17831 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17832 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17833 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17834 | } |
| 17835 | |
| 17836 | static int patch_alc662(struct hda_codec *codec) |
| 17837 | { |
| 17838 | struct alc_spec *spec; |
| 17839 | int err, board_config; |
| 17840 | |
| 17841 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17842 | if (!spec) |
| 17843 | return -ENOMEM; |
| 17844 | |
| 17845 | codec->spec = spec; |
| 17846 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 17847 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 17848 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 17849 | if (alc_read_coef_idx(codec, 0)==0x8020){ |
| 17850 | kfree(codec->chip_name); |
| 17851 | codec->chip_name = kstrdup("ALC661", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 17852 | if (!codec->chip_name) { |
| 17853 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 17854 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 17855 | } |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 17856 | } |
| 17857 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17858 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 17859 | alc662_models, |
| 17860 | alc662_cfg_tbl); |
| 17861 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 17862 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 17863 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17864 | board_config = ALC662_AUTO; |
| 17865 | } |
| 17866 | |
| 17867 | if (board_config == ALC662_AUTO) { |
| 17868 | /* automatic parse from the BIOS config */ |
| 17869 | err = alc662_parse_auto_config(codec); |
| 17870 | if (err < 0) { |
| 17871 | alc_free(codec); |
| 17872 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17873 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17874 | printk(KERN_INFO |
| 17875 | "hda_codec: Cannot set up configuration " |
| 17876 | "from BIOS. Using base mode...\n"); |
| 17877 | board_config = ALC662_3ST_2ch_DIG; |
| 17878 | } |
| 17879 | } |
| 17880 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17881 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 17882 | if (err < 0) { |
| 17883 | alc_free(codec); |
| 17884 | return err; |
| 17885 | } |
| 17886 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17887 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 17888 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17889 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17890 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 17891 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 17892 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17893 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 17894 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 17895 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 17896 | if (!spec->adc_nids) { |
| 17897 | spec->adc_nids = alc662_adc_nids; |
| 17898 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 17899 | } |
| 17900 | if (!spec->capsrc_nids) |
| 17901 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17902 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17903 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17904 | set_capture_mixer(codec); |
Takashi Iwai | b959144 | 2009-03-16 15:25:00 +0100 | [diff] [blame] | 17905 | if (codec->vendor_id == 0x10ec0662) |
| 17906 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 17907 | else |
| 17908 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17909 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17910 | spec->vmaster_nid = 0x02; |
| 17911 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17912 | codec->patch_ops = alc_patch_ops; |
| 17913 | if (board_config == ALC662_AUTO) |
| 17914 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17915 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17916 | if (!spec->loopback.amplist) |
| 17917 | spec->loopback.amplist = alc662_loopbacks; |
| 17918 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 17919 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17920 | |
| 17921 | return 0; |
| 17922 | } |
| 17923 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 17924 | static int patch_alc888(struct hda_codec *codec) |
| 17925 | { |
| 17926 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 17927 | kfree(codec->chip_name); |
| 17928 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 17929 | if (!codec->chip_name) { |
| 17930 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 17931 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 17932 | } |
| 17933 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 17934 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 17935 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 17936 | } |
| 17937 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17938 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17939 | * patch entries |
| 17940 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17941 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17942 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17943 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17944 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 17945 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17946 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17947 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 17948 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17949 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17950 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17951 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17952 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 17953 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 17954 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17955 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17956 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17957 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 17958 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17959 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17960 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17961 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17962 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 17963 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17964 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 17965 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17966 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17967 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17968 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 17969 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17970 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 17971 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17972 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 17973 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17974 | {} /* terminator */ |
| 17975 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17976 | |
| 17977 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 17978 | |
| 17979 | MODULE_LICENSE("GPL"); |
| 17980 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 17981 | |
| 17982 | static struct hda_codec_preset_list realtek_list = { |
| 17983 | .preset = snd_hda_preset_realtek, |
| 17984 | .owner = THIS_MODULE, |
| 17985 | }; |
| 17986 | |
| 17987 | static int __init patch_realtek_init(void) |
| 17988 | { |
| 17989 | return snd_hda_add_codec_preset(&realtek_list); |
| 17990 | } |
| 17991 | |
| 17992 | static void __exit patch_realtek_exit(void) |
| 17993 | { |
| 17994 | snd_hda_delete_codec_preset(&realtek_list); |
| 17995 | } |
| 17996 | |
| 17997 | module_init(patch_realtek_init) |
| 17998 | module_exit(patch_realtek_exit) |