Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
| 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 | 7cf51e48 | 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 | bab282b9 | 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 | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 249 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550a | 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 | 4953550a | 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); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 340 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 341 | void (*power_hook)(struct hda_codec *codec, int power); |
| 342 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 343 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 344 | /* for pin sensing */ |
| 345 | unsigned int sense_updated: 1; |
| 346 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 347 | unsigned int master_sw: 1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 348 | unsigned int auto_mic:1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 349 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 350 | /* other flags */ |
| 351 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 352 | int init_amp; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 353 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 354 | /* for virtual master */ |
| 355 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 356 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 357 | struct hda_loopback_check loopback; |
| 358 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 359 | |
| 360 | /* for PLL fix */ |
| 361 | hda_nid_t pll_nid; |
| 362 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 363 | }; |
| 364 | |
| 365 | /* |
| 366 | * configuration template - to be copied to the spec instance |
| 367 | */ |
| 368 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 369 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 370 | * with spec |
| 371 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 372 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 373 | const struct hda_verb *init_verbs[5]; |
| 374 | unsigned int num_dacs; |
| 375 | hda_nid_t *dac_nids; |
| 376 | hda_nid_t dig_out_nid; /* optional */ |
| 377 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 378 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 379 | unsigned int num_adc_nids; |
| 380 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 381 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 382 | hda_nid_t dig_in_nid; |
| 383 | unsigned int num_channel_mode; |
| 384 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 385 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 386 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 387 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 388 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 389 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 390 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 391 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 392 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 393 | struct hda_amp_list *loopbacks; |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 394 | void (*power_hook)(struct hda_codec *codec, int power); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 395 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 396 | }; |
| 397 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 398 | |
| 399 | /* |
| 400 | * input MUX handling |
| 401 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 402 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 403 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 404 | { |
| 405 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 406 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 407 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 408 | if (mux_idx >= spec->num_mux_defs) |
| 409 | mux_idx = 0; |
| 410 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 411 | } |
| 412 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 413 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 414 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 415 | { |
| 416 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 417 | struct alc_spec *spec = codec->spec; |
| 418 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 419 | |
| 420 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 421 | return 0; |
| 422 | } |
| 423 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 424 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 425 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 426 | { |
| 427 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 428 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 429 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 430 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 431 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 432 | hda_nid_t nid = spec->capsrc_nids ? |
| 433 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 434 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 435 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 436 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 437 | imux = &spec->input_mux[mux_idx]; |
| 438 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 439 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 440 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 441 | /* Matrix-mixer style (e.g. ALC882) */ |
| 442 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 443 | unsigned int i, idx; |
| 444 | |
| 445 | idx = ucontrol->value.enumerated.item[0]; |
| 446 | if (idx >= imux->num_items) |
| 447 | idx = imux->num_items - 1; |
| 448 | if (*cur_val == idx) |
| 449 | return 0; |
| 450 | for (i = 0; i < imux->num_items; i++) { |
| 451 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 452 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 453 | imux->items[i].index, |
| 454 | HDA_AMP_MUTE, v); |
| 455 | } |
| 456 | *cur_val = idx; |
| 457 | return 1; |
| 458 | } else { |
| 459 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 460 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 461 | &spec->cur_mux[adc_idx]); |
| 462 | } |
| 463 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 464 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 465 | /* |
| 466 | * channel mode setting |
| 467 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 468 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 469 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 470 | { |
| 471 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 472 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 473 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 474 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 475 | } |
| 476 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 477 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 478 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 479 | { |
| 480 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 481 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 482 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 483 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 484 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 485 | } |
| 486 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 487 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 488 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 489 | { |
| 490 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 491 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 492 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 493 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 494 | &spec->ext_channel_count); |
| 495 | if (err >= 0 && !spec->const_channel_count) { |
| 496 | spec->multiout.max_channels = spec->ext_channel_count; |
| 497 | if (spec->need_dac_fix) |
| 498 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 499 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 500 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 501 | } |
| 502 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 503 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 504 | * 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] | 505 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 506 | * being part of a format specifier. Maximum allowed length of a value is |
| 507 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 508 | * |
| 509 | * Note: some retasking pin complexes seem to ignore requests for input |
| 510 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 511 | * are requested. Therefore order this list so that this behaviour will not |
| 512 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 513 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 514 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 515 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 516 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 517 | "Mic 50pc bias", "Mic 80pc bias", |
| 518 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 519 | }; |
| 520 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 521 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 522 | }; |
| 523 | /* 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] | 524 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 525 | * addition, "input" pins may or may not process the mic bias option |
| 526 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 527 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 528 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 529 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 530 | #define ALC_PIN_DIR_IN 0x00 |
| 531 | #define ALC_PIN_DIR_OUT 0x01 |
| 532 | #define ALC_PIN_DIR_INOUT 0x02 |
| 533 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 534 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 535 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 536 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 537 | * For each direction the minimum and maximum values are given. |
| 538 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 539 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 540 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 541 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 542 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 543 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 544 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 545 | }; |
| 546 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 547 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 548 | #define alc_pin_mode_n_items(_dir) \ |
| 549 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 550 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 551 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 552 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 553 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 554 | unsigned int item_num = uinfo->value.enumerated.item; |
| 555 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 556 | |
| 557 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 558 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 559 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 560 | |
| 561 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 562 | item_num = alc_pin_mode_min(dir); |
| 563 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 564 | return 0; |
| 565 | } |
| 566 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 567 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 568 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 569 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 570 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 571 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 572 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 573 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 574 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 575 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 576 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 577 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 578 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 579 | /* Find enumerated value for current pinctl setting */ |
| 580 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 581 | 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] | 582 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 583 | *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] | 584 | return 0; |
| 585 | } |
| 586 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 587 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 588 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 589 | { |
| 590 | signed int change; |
| 591 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 592 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 593 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 594 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 595 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 596 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 597 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 598 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 599 | 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] | 600 | val = alc_pin_mode_min(dir); |
| 601 | |
| 602 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 603 | if (change) { |
| 604 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 605 | snd_hda_codec_write_cache(codec, nid, 0, |
| 606 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 607 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 608 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 609 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 610 | * for the requested pin mode. Enum values of 2 or less are |
| 611 | * input modes. |
| 612 | * |
| 613 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 614 | * reduces noise slightly (particularly on input) so we'll |
| 615 | * do it. However, having both input and output buffers |
| 616 | * enabled simultaneously doesn't seem to be problematic if |
| 617 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 618 | */ |
| 619 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 620 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 621 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 622 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 623 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 624 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 625 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 626 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 627 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 628 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 629 | } |
| 630 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 631 | return change; |
| 632 | } |
| 633 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 634 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 635 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 636 | .info = alc_pin_mode_info, \ |
| 637 | .get = alc_pin_mode_get, \ |
| 638 | .put = alc_pin_mode_put, \ |
| 639 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 640 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 641 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 642 | * together using a mask with more than one bit set. This control is |
| 643 | * currently used only by the ALC260 test model. At this stage they are not |
| 644 | * needed for any "production" models. |
| 645 | */ |
| 646 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 647 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 648 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 649 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 650 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 651 | { |
| 652 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 653 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 654 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 655 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 656 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 657 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 658 | |
| 659 | *valp = (val & mask) != 0; |
| 660 | return 0; |
| 661 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 662 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 663 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 664 | { |
| 665 | signed int change; |
| 666 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 667 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 668 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 669 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 670 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 671 | AC_VERB_GET_GPIO_DATA, |
| 672 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 673 | |
| 674 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 675 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 676 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 677 | gpio_data &= ~mask; |
| 678 | else |
| 679 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 680 | snd_hda_codec_write_cache(codec, nid, 0, |
| 681 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 682 | |
| 683 | return change; |
| 684 | } |
| 685 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 686 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 687 | .info = alc_gpio_data_info, \ |
| 688 | .get = alc_gpio_data_get, \ |
| 689 | .put = alc_gpio_data_put, \ |
| 690 | .private_value = nid | (mask<<16) } |
| 691 | #endif /* CONFIG_SND_DEBUG */ |
| 692 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 693 | /* A switch control to allow the enabling of the digital IO pins on the |
| 694 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 695 | * to provide something in the test model allowing digital outputs to be |
| 696 | * identified if present. If models are found which can utilise these |
| 697 | * outputs a more complete mixer control can be devised for those models if |
| 698 | * necessary. |
| 699 | */ |
| 700 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 701 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 702 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 703 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 704 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 705 | { |
| 706 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 707 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 708 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 709 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 710 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 711 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 712 | |
| 713 | *valp = (val & mask) != 0; |
| 714 | return 0; |
| 715 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 716 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 717 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 718 | { |
| 719 | signed int change; |
| 720 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 721 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 722 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 723 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 724 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 725 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 726 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 727 | |
| 728 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 729 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 730 | if (val==0) |
| 731 | ctrl_data &= ~mask; |
| 732 | else |
| 733 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 734 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 735 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 736 | |
| 737 | return change; |
| 738 | } |
| 739 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 740 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 741 | .info = alc_spdif_ctrl_info, \ |
| 742 | .get = alc_spdif_ctrl_get, \ |
| 743 | .put = alc_spdif_ctrl_put, \ |
| 744 | .private_value = nid | (mask<<16) } |
| 745 | #endif /* CONFIG_SND_DEBUG */ |
| 746 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 747 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 748 | * Again, this is only used in the ALC26x test models to help identify when |
| 749 | * the EAPD line must be asserted for features to work. |
| 750 | */ |
| 751 | #ifdef CONFIG_SND_DEBUG |
| 752 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 753 | |
| 754 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 755 | struct snd_ctl_elem_value *ucontrol) |
| 756 | { |
| 757 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 758 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 759 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 760 | long *valp = ucontrol->value.integer.value; |
| 761 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 762 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 763 | |
| 764 | *valp = (val & mask) != 0; |
| 765 | return 0; |
| 766 | } |
| 767 | |
| 768 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 769 | struct snd_ctl_elem_value *ucontrol) |
| 770 | { |
| 771 | int change; |
| 772 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 773 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 774 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 775 | long val = *ucontrol->value.integer.value; |
| 776 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 777 | AC_VERB_GET_EAPD_BTLENABLE, |
| 778 | 0x00); |
| 779 | |
| 780 | /* Set/unset the masked control bit(s) as needed */ |
| 781 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 782 | if (!val) |
| 783 | ctrl_data &= ~mask; |
| 784 | else |
| 785 | ctrl_data |= mask; |
| 786 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 787 | ctrl_data); |
| 788 | |
| 789 | return change; |
| 790 | } |
| 791 | |
| 792 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 793 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 794 | .info = alc_eapd_ctrl_info, \ |
| 795 | .get = alc_eapd_ctrl_get, \ |
| 796 | .put = alc_eapd_ctrl_put, \ |
| 797 | .private_value = nid | (mask<<16) } |
| 798 | #endif /* CONFIG_SND_DEBUG */ |
| 799 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 800 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 801 | * set up the input pin config (depending on the given auto-pin type) |
| 802 | */ |
| 803 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 804 | int auto_pin_type) |
| 805 | { |
| 806 | unsigned int val = PIN_IN; |
| 807 | |
| 808 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { |
| 809 | unsigned int pincap; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 810 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 811 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 812 | if (pincap & AC_PINCAP_VREF_80) |
| 813 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 814 | else if (pincap & AC_PINCAP_VREF_50) |
| 815 | val = PIN_VREF50; |
| 816 | else if (pincap & AC_PINCAP_VREF_100) |
| 817 | val = PIN_VREF100; |
| 818 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 819 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 820 | } |
| 821 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 822 | } |
| 823 | |
| 824 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 825 | */ |
| 826 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 827 | { |
| 828 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 829 | return; |
| 830 | spec->mixers[spec->num_mixers++] = mix; |
| 831 | } |
| 832 | |
| 833 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 834 | { |
| 835 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 836 | return; |
| 837 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 838 | } |
| 839 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 840 | #ifdef CONFIG_PROC_FS |
| 841 | /* |
| 842 | * hook for proc |
| 843 | */ |
| 844 | static void print_realtek_coef(struct snd_info_buffer *buffer, |
| 845 | struct hda_codec *codec, hda_nid_t nid) |
| 846 | { |
| 847 | int coeff; |
| 848 | |
| 849 | if (nid != 0x20) |
| 850 | return; |
| 851 | coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); |
| 852 | snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); |
| 853 | coeff = snd_hda_codec_read(codec, nid, 0, |
| 854 | AC_VERB_GET_COEF_INDEX, 0); |
| 855 | snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); |
| 856 | } |
| 857 | #else |
| 858 | #define print_realtek_coef NULL |
| 859 | #endif |
| 860 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 861 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 862 | * set up from the preset table |
| 863 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 864 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 865 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 866 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 867 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 868 | int i; |
| 869 | |
| 870 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 871 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 872 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 873 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 874 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 875 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 876 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 877 | spec->channel_mode = preset->channel_mode; |
| 878 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 879 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 880 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 881 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 882 | if (preset->const_channel_count) |
| 883 | spec->multiout.max_channels = preset->const_channel_count; |
| 884 | else |
| 885 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 886 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 887 | |
| 888 | spec->multiout.num_dacs = preset->num_dacs; |
| 889 | spec->multiout.dac_nids = preset->dac_nids; |
| 890 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 891 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 892 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 893 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 894 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 895 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 896 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 897 | spec->input_mux = preset->input_mux; |
| 898 | |
| 899 | spec->num_adc_nids = preset->num_adc_nids; |
| 900 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 901 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 902 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 903 | |
| 904 | spec->unsol_event = preset->unsol_event; |
| 905 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 906 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 907 | spec->power_hook = preset->power_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 908 | spec->loopback.amplist = preset->loopbacks; |
| 909 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 910 | |
| 911 | if (preset->setup) |
| 912 | preset->setup(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 913 | } |
| 914 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 915 | /* Enable GPIO mask and set output */ |
| 916 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 917 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 918 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 919 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 920 | { } |
| 921 | }; |
| 922 | |
| 923 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 924 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 925 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 926 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 927 | { } |
| 928 | }; |
| 929 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 930 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 931 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 932 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 933 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 934 | { } |
| 935 | }; |
| 936 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 937 | /* |
| 938 | * Fix hardware PLL issue |
| 939 | * On some codecs, the analog PLL gating control must be off while |
| 940 | * the default value is 1. |
| 941 | */ |
| 942 | static void alc_fix_pll(struct hda_codec *codec) |
| 943 | { |
| 944 | struct alc_spec *spec = codec->spec; |
| 945 | unsigned int val; |
| 946 | |
| 947 | if (!spec->pll_nid) |
| 948 | return; |
| 949 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 950 | spec->pll_coef_idx); |
| 951 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 952 | AC_VERB_GET_PROC_COEF, 0); |
| 953 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 954 | spec->pll_coef_idx); |
| 955 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 956 | val & ~(1 << spec->pll_coef_bit)); |
| 957 | } |
| 958 | |
| 959 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 960 | unsigned int coef_idx, unsigned int coef_bit) |
| 961 | { |
| 962 | struct alc_spec *spec = codec->spec; |
| 963 | spec->pll_nid = nid; |
| 964 | spec->pll_coef_idx = coef_idx; |
| 965 | spec->pll_coef_bit = coef_bit; |
| 966 | alc_fix_pll(codec); |
| 967 | } |
| 968 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 969 | static void alc_automute_pin(struct hda_codec *codec) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 970 | { |
| 971 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 972 | unsigned int nid = spec->autocfg.hp_pins[0]; |
| 973 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 974 | |
Takashi Iwai | ad87c64 | 2009-11-02 14:23:15 +0100 | [diff] [blame] | 975 | if (!nid) |
| 976 | return; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 977 | spec->jack_present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 978 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 979 | nid = spec->autocfg.speaker_pins[i]; |
| 980 | if (!nid) |
| 981 | break; |
| 982 | snd_hda_codec_write(codec, nid, 0, |
| 983 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 984 | spec->jack_present ? 0 : PIN_OUT); |
| 985 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 986 | } |
| 987 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 988 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 989 | hda_nid_t nid) |
| 990 | { |
| 991 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 992 | int i, nums; |
| 993 | |
| 994 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 995 | for (i = 0; i < nums; i++) |
| 996 | if (conn[i] == nid) |
| 997 | return i; |
| 998 | return -1; |
| 999 | } |
| 1000 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1001 | static void alc_mic_automute(struct hda_codec *codec) |
| 1002 | { |
| 1003 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1004 | struct alc_mic_route *dead, *alive; |
| 1005 | unsigned int present, type; |
| 1006 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1007 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1008 | if (!spec->auto_mic) |
| 1009 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1010 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1011 | return; |
| 1012 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1013 | return; |
| 1014 | |
| 1015 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1016 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1017 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1018 | if (present) { |
| 1019 | alive = &spec->ext_mic; |
| 1020 | dead = &spec->int_mic; |
| 1021 | } else { |
| 1022 | alive = &spec->int_mic; |
| 1023 | dead = &spec->ext_mic; |
| 1024 | } |
| 1025 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1026 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1027 | if (type == AC_WID_AUD_MIX) { |
| 1028 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1029 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1030 | alive->mux_idx, |
| 1031 | HDA_AMP_MUTE, 0); |
| 1032 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1033 | dead->mux_idx, |
| 1034 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1035 | } else { |
| 1036 | /* MUX style (e.g. ALC880) */ |
| 1037 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1038 | AC_VERB_SET_CONNECT_SEL, |
| 1039 | alive->mux_idx); |
| 1040 | } |
| 1041 | |
| 1042 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1043 | } |
| 1044 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1045 | /* unsolicited event for HP jack sensing */ |
| 1046 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1047 | { |
| 1048 | if (codec->vendor_id == 0x10ec0880) |
| 1049 | res >>= 28; |
| 1050 | else |
| 1051 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1052 | switch (res) { |
| 1053 | case ALC880_HP_EVENT: |
| 1054 | alc_automute_pin(codec); |
| 1055 | break; |
| 1056 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1057 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1058 | break; |
| 1059 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1060 | } |
| 1061 | |
| 1062 | static void alc_inithook(struct hda_codec *codec) |
| 1063 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1064 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1065 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1066 | } |
| 1067 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1068 | /* additional initialization for ALC888 variants */ |
| 1069 | static void alc888_coef_init(struct hda_codec *codec) |
| 1070 | { |
| 1071 | unsigned int tmp; |
| 1072 | |
| 1073 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1074 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1075 | 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] | 1076 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1077 | /* alc888S-VC */ |
| 1078 | snd_hda_codec_read(codec, 0x20, 0, |
| 1079 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1080 | else |
| 1081 | /* alc888-VB */ |
| 1082 | snd_hda_codec_read(codec, 0x20, 0, |
| 1083 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1084 | } |
| 1085 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1086 | static void alc889_coef_init(struct hda_codec *codec) |
| 1087 | { |
| 1088 | unsigned int tmp; |
| 1089 | |
| 1090 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1091 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1092 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1093 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1094 | } |
| 1095 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1096 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1097 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1098 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1099 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1100 | switch (type) { |
| 1101 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1102 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1103 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1104 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1105 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1106 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1107 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1108 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1109 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1110 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1111 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1112 | case 0x10ec0260: |
| 1113 | snd_hda_codec_write(codec, 0x0f, 0, |
| 1114 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1115 | snd_hda_codec_write(codec, 0x10, 0, |
| 1116 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1117 | break; |
| 1118 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1119 | case 0x10ec0267: |
| 1120 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1121 | case 0x10ec0269: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1122 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1123 | case 0x10ec0660: |
| 1124 | case 0x10ec0662: |
| 1125 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1126 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1127 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1128 | snd_hda_codec_write(codec, 0x14, 0, |
| 1129 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1130 | snd_hda_codec_write(codec, 0x15, 0, |
| 1131 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1132 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1133 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1134 | switch (codec->vendor_id) { |
| 1135 | case 0x10ec0260: |
| 1136 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1137 | AC_VERB_SET_COEF_INDEX, 7); |
| 1138 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1139 | AC_VERB_GET_PROC_COEF, 0); |
| 1140 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1141 | AC_VERB_SET_COEF_INDEX, 7); |
| 1142 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1143 | AC_VERB_SET_PROC_COEF, |
| 1144 | tmp | 0x2010); |
| 1145 | break; |
| 1146 | case 0x10ec0262: |
| 1147 | case 0x10ec0880: |
| 1148 | case 0x10ec0882: |
| 1149 | case 0x10ec0883: |
| 1150 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1151 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1152 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1153 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1154 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1155 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1156 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1157 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1158 | case 0x10ec0267: |
| 1159 | case 0x10ec0268: |
| 1160 | snd_hda_codec_write(codec, 0x20, 0, |
| 1161 | AC_VERB_SET_COEF_INDEX, 7); |
| 1162 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1163 | AC_VERB_GET_PROC_COEF, 0); |
| 1164 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1165 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1166 | snd_hda_codec_write(codec, 0x20, 0, |
| 1167 | AC_VERB_SET_PROC_COEF, |
| 1168 | tmp | 0x3000); |
| 1169 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1170 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1171 | break; |
| 1172 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1173 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1174 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1175 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1176 | { |
| 1177 | struct alc_spec *spec = codec->spec; |
| 1178 | |
| 1179 | if (!spec->autocfg.hp_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1180 | return; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1181 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1182 | if (!spec->autocfg.speaker_pins[0]) { |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1183 | if (spec->autocfg.line_out_pins[0] && |
| 1184 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1185 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1186 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1187 | else |
| 1188 | return; |
| 1189 | } |
| 1190 | |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1191 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1192 | spec->autocfg.hp_pins[0]); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1193 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, |
| 1194 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1195 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1196 | spec->unsol_event = alc_sku_unsol_event; |
| 1197 | } |
| 1198 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1199 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1200 | { |
| 1201 | struct alc_spec *spec = codec->spec; |
| 1202 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1203 | hda_nid_t fixed, ext; |
| 1204 | int i; |
| 1205 | |
| 1206 | /* there must be only two mic inputs exclusively */ |
| 1207 | for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++) |
| 1208 | if (cfg->input_pins[i]) |
| 1209 | return; |
| 1210 | |
| 1211 | fixed = ext = 0; |
| 1212 | for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) { |
| 1213 | hda_nid_t nid = cfg->input_pins[i]; |
| 1214 | unsigned int defcfg; |
| 1215 | if (!nid) |
| 1216 | return; |
| 1217 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
| 1218 | switch (get_defcfg_connect(defcfg)) { |
| 1219 | case AC_JACK_PORT_FIXED: |
| 1220 | if (fixed) |
| 1221 | return; /* already occupied */ |
| 1222 | fixed = nid; |
| 1223 | break; |
| 1224 | case AC_JACK_PORT_COMPLEX: |
| 1225 | if (ext) |
| 1226 | return; /* already occupied */ |
| 1227 | ext = nid; |
| 1228 | break; |
| 1229 | default: |
| 1230 | return; /* invalid entry */ |
| 1231 | } |
| 1232 | } |
| 1233 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1234 | return; /* no unsol support */ |
| 1235 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1236 | ext, fixed); |
| 1237 | spec->ext_mic.pin = ext; |
| 1238 | spec->int_mic.pin = fixed; |
| 1239 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1240 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1241 | spec->auto_mic = 1; |
| 1242 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1243 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1244 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1245 | spec->unsol_event = alc_sku_unsol_event; |
| 1246 | } |
| 1247 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1248 | /* check subsystem ID and set up device-specific initialization; |
| 1249 | * return 1 if initialized, 0 if invalid SSID |
| 1250 | */ |
| 1251 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1252 | * 31 ~ 16 : Manufacture ID |
| 1253 | * 15 ~ 8 : SKU ID |
| 1254 | * 7 ~ 0 : Assembly ID |
| 1255 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1256 | */ |
| 1257 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1258 | hda_nid_t porta, hda_nid_t porte, |
| 1259 | hda_nid_t portd) |
| 1260 | { |
| 1261 | unsigned int ass, tmp, i; |
| 1262 | unsigned nid; |
| 1263 | struct alc_spec *spec = codec->spec; |
| 1264 | |
| 1265 | ass = codec->subsystem_id & 0xffff; |
| 1266 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1267 | goto do_sku; |
| 1268 | |
| 1269 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1270 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1271 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1272 | * 29~21 : reserve |
| 1273 | * 20 : PCBEEP input |
| 1274 | * 19~16 : Check sum (15:1) |
| 1275 | * 15~1 : Custom |
| 1276 | * 0 : override |
| 1277 | */ |
| 1278 | nid = 0x1d; |
| 1279 | if (codec->vendor_id == 0x10ec0260) |
| 1280 | nid = 0x17; |
| 1281 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1282 | snd_printd("realtek: No valid SSID, " |
| 1283 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1284 | ass, nid); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1285 | if (!(ass & 1) && !(ass & 0x100000)) |
| 1286 | return 0; |
| 1287 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1288 | return 0; |
| 1289 | |
| 1290 | /* check sum */ |
| 1291 | tmp = 0; |
| 1292 | for (i = 1; i < 16; i++) { |
| 1293 | if ((ass >> i) & 1) |
| 1294 | tmp++; |
| 1295 | } |
| 1296 | if (((ass >> 16) & 0xf) != tmp) |
| 1297 | return 0; |
| 1298 | do_sku: |
| 1299 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1300 | ass & 0xffff, codec->vendor_id); |
| 1301 | /* |
| 1302 | * 0 : override |
| 1303 | * 1 : Swap Jack |
| 1304 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1305 | * 3~5 : External Amplifier control |
| 1306 | * 7~6 : Reserved |
| 1307 | */ |
| 1308 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1309 | switch (tmp) { |
| 1310 | case 1: |
| 1311 | spec->init_amp = ALC_INIT_GPIO1; |
| 1312 | break; |
| 1313 | case 3: |
| 1314 | spec->init_amp = ALC_INIT_GPIO2; |
| 1315 | break; |
| 1316 | case 7: |
| 1317 | spec->init_amp = ALC_INIT_GPIO3; |
| 1318 | break; |
| 1319 | case 5: |
| 1320 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1321 | break; |
| 1322 | } |
| 1323 | |
| 1324 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1325 | * when the external headphone out jack is plugged" |
| 1326 | */ |
| 1327 | if (!(ass & 0x8000)) |
| 1328 | return 1; |
| 1329 | /* |
| 1330 | * 10~8 : Jack location |
| 1331 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1332 | * 14~13: Resvered |
| 1333 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1334 | * when the external headphone out jack is plugged" |
| 1335 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1336 | if (!spec->autocfg.hp_pins[0]) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1337 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1338 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1339 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1340 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1341 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1342 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1343 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1344 | nid = portd; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1345 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1346 | return 1; |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1347 | for (i = 0; i < spec->autocfg.line_outs; i++) |
| 1348 | if (spec->autocfg.line_out_pins[i] == nid) |
| 1349 | return 1; |
| 1350 | spec->autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1351 | } |
| 1352 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1353 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1354 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1355 | return 1; |
| 1356 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1357 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1358 | static void alc_ssid_check(struct hda_codec *codec, |
| 1359 | hda_nid_t porta, hda_nid_t porte, hda_nid_t portd) |
| 1360 | { |
| 1361 | if (!alc_subsystem_id(codec, porta, porte, portd)) { |
| 1362 | struct alc_spec *spec = codec->spec; |
| 1363 | snd_printd("realtek: " |
| 1364 | "Enable default setup for auto mode as fallback\n"); |
| 1365 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1366 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1367 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1368 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1369 | } |
| 1370 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1371 | /* |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1372 | * Fix-up pin default configurations and add default verbs |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1373 | */ |
| 1374 | |
| 1375 | struct alc_pincfg { |
| 1376 | hda_nid_t nid; |
| 1377 | u32 val; |
| 1378 | }; |
| 1379 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1380 | struct alc_fixup { |
| 1381 | const struct alc_pincfg *pins; |
| 1382 | const struct hda_verb *verbs; |
| 1383 | }; |
| 1384 | |
| 1385 | static void alc_pick_fixup(struct hda_codec *codec, |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1386 | const struct snd_pci_quirk *quirk, |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1387 | const struct alc_fixup *fix) |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1388 | { |
| 1389 | const struct alc_pincfg *cfg; |
| 1390 | |
| 1391 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1392 | if (!quirk) |
| 1393 | return; |
| 1394 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1395 | fix += quirk->value; |
| 1396 | cfg = fix->pins; |
| 1397 | if (cfg) { |
| 1398 | for (; cfg->nid; cfg++) |
| 1399 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
| 1400 | } |
| 1401 | if (fix->verbs) |
| 1402 | add_verb(codec->spec, fix->verbs); |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1403 | } |
| 1404 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 1405 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 1406 | unsigned int coef_idx) |
| 1407 | { |
| 1408 | unsigned int val; |
| 1409 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1410 | coef_idx); |
| 1411 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 1412 | AC_VERB_GET_PROC_COEF, 0); |
| 1413 | return val; |
| 1414 | } |
| 1415 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1416 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1417 | * ALC888 |
| 1418 | */ |
| 1419 | |
| 1420 | /* |
| 1421 | * 2ch mode |
| 1422 | */ |
| 1423 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1424 | /* Mic-in jack as mic in */ |
| 1425 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1426 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1427 | /* Line-in jack as Line in */ |
| 1428 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1429 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1430 | /* Line-Out as Front */ |
| 1431 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1432 | { } /* end */ |
| 1433 | }; |
| 1434 | |
| 1435 | /* |
| 1436 | * 4ch mode |
| 1437 | */ |
| 1438 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1439 | /* Mic-in jack as mic in */ |
| 1440 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1441 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1442 | /* Line-in jack as Surround */ |
| 1443 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1444 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1445 | /* Line-Out as Front */ |
| 1446 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1447 | { } /* end */ |
| 1448 | }; |
| 1449 | |
| 1450 | /* |
| 1451 | * 6ch mode |
| 1452 | */ |
| 1453 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1454 | /* Mic-in jack as CLFE */ |
| 1455 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1456 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1457 | /* Line-in jack as Surround */ |
| 1458 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1459 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1460 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1461 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1462 | { } /* end */ |
| 1463 | }; |
| 1464 | |
| 1465 | /* |
| 1466 | * 8ch mode |
| 1467 | */ |
| 1468 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1469 | /* Mic-in jack as CLFE */ |
| 1470 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1471 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1472 | /* Line-in jack as Surround */ |
| 1473 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1474 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1475 | /* Line-Out as Side */ |
| 1476 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1477 | { } /* end */ |
| 1478 | }; |
| 1479 | |
| 1480 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1481 | { 2, alc888_4ST_ch2_intel_init }, |
| 1482 | { 4, alc888_4ST_ch4_intel_init }, |
| 1483 | { 6, alc888_4ST_ch6_intel_init }, |
| 1484 | { 8, alc888_4ST_ch8_intel_init }, |
| 1485 | }; |
| 1486 | |
| 1487 | /* |
| 1488 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1489 | */ |
| 1490 | |
| 1491 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1492 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1493 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1494 | /* Connect Internal HP to Front */ |
| 1495 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1496 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1497 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1498 | /* Connect Bass HP to Front */ |
| 1499 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1500 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1501 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1502 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1503 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1504 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1505 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1506 | /* Connect Mic jack to CLFE */ |
| 1507 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1508 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1509 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1510 | /* Connect Line-in jack to Surround */ |
| 1511 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1512 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1513 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1514 | /* Connect HP out jack to Front */ |
| 1515 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1516 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1517 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1518 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1519 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1520 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1521 | {} |
| 1522 | }; |
| 1523 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1524 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1525 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1526 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1527 | unsigned int mute; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1528 | hda_nid_t nid; |
| 1529 | int i; |
| 1530 | |
| 1531 | spec->jack_present = 0; |
| 1532 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1533 | nid = spec->autocfg.hp_pins[i]; |
| 1534 | if (!nid) |
| 1535 | break; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1536 | if (snd_hda_jack_detect(codec, nid)) { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1537 | spec->jack_present = 1; |
| 1538 | break; |
| 1539 | } |
| 1540 | } |
| 1541 | |
| 1542 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1543 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1544 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1545 | nid = spec->autocfg.speaker_pins[i]; |
| 1546 | if (!nid) |
| 1547 | break; |
| 1548 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1549 | HDA_AMP_MUTE, mute); |
| 1550 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1551 | } |
| 1552 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1553 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1554 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1555 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1556 | if (codec->vendor_id == 0x10ec0880) |
| 1557 | res >>= 28; |
| 1558 | else |
| 1559 | res >>= 26; |
| 1560 | if (res == ALC880_HP_EVENT) |
| 1561 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1562 | } |
| 1563 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1564 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1565 | { |
| 1566 | struct alc_spec *spec = codec->spec; |
| 1567 | |
| 1568 | spec->autocfg.hp_pins[0] = 0x15; |
| 1569 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1570 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1571 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1572 | spec->autocfg.speaker_pins[3] = 0x19; |
| 1573 | spec->autocfg.speaker_pins[4] = 0x1a; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1574 | } |
| 1575 | |
| 1576 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 1577 | { |
| 1578 | alc889_coef_init(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1579 | alc_automute_amp(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1580 | } |
| 1581 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1582 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1583 | { |
| 1584 | struct alc_spec *spec = codec->spec; |
| 1585 | |
| 1586 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1587 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1588 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1589 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1590 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1591 | |
| 1592 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1593 | * ALC888 Acer Aspire 4930G model |
| 1594 | */ |
| 1595 | |
| 1596 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1597 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1598 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1599 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1600 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1601 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1602 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1603 | /* Connect Internal HP to front */ |
| 1604 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1605 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1606 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1607 | /* Connect HP out to front */ |
| 1608 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1609 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1610 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1611 | { } |
| 1612 | }; |
| 1613 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1614 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1615 | * ALC888 Acer Aspire 6530G model |
| 1616 | */ |
| 1617 | |
| 1618 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
| 1619 | /* Bias voltage on for external mic port */ |
| 1620 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1621 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1622 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1623 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1624 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1625 | /* Enable unsolicited event for HP jack */ |
| 1626 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1627 | /* Enable speaker output */ |
| 1628 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1629 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1630 | /* Enable headphone output */ |
| 1631 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 1632 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1633 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1634 | { } |
| 1635 | }; |
| 1636 | |
| 1637 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1638 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1639 | */ |
| 1640 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1641 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1642 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1643 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1644 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1645 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 1646 | /* Enable unsolicited event for HP jack */ |
| 1647 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1648 | /* Connect Internal Front to Front */ |
| 1649 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1650 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1651 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1652 | /* Connect Internal Rear to Rear */ |
| 1653 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1654 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1655 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1656 | /* Connect Internal CLFE to CLFE */ |
| 1657 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1658 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1659 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1660 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1661 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1662 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1663 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1664 | /* Enable all DACs */ |
| 1665 | /* DAC DISABLE/MUTE 1? */ |
| 1666 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 1667 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 1668 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1669 | /* DAC DISABLE/MUTE 2? */ |
| 1670 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 1671 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 1672 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1673 | /* DMIC fix |
| 1674 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 1675 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 1676 | * makes the signal become a difference/sum signal instead of standard |
| 1677 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 1678 | * codec replicate the sum signal to both channels, turning it into a |
| 1679 | * normal mono mic. |
| 1680 | */ |
| 1681 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 1682 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 1683 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1684 | { } |
| 1685 | }; |
| 1686 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1687 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1688 | /* Front mic only available on one ADC */ |
| 1689 | { |
| 1690 | .num_items = 4, |
| 1691 | .items = { |
| 1692 | { "Mic", 0x0 }, |
| 1693 | { "Line", 0x2 }, |
| 1694 | { "CD", 0x4 }, |
| 1695 | { "Front Mic", 0xb }, |
| 1696 | }, |
| 1697 | }, |
| 1698 | { |
| 1699 | .num_items = 3, |
| 1700 | .items = { |
| 1701 | { "Mic", 0x0 }, |
| 1702 | { "Line", 0x2 }, |
| 1703 | { "CD", 0x4 }, |
| 1704 | }, |
| 1705 | } |
| 1706 | }; |
| 1707 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1708 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 1709 | /* Interal mic only available on one ADC */ |
| 1710 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1711 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1712 | .items = { |
| 1713 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1714 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1715 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1716 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1717 | { "Int Mic", 0xb }, |
| 1718 | }, |
| 1719 | }, |
| 1720 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1721 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1722 | .items = { |
| 1723 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1724 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1725 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1726 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1727 | }, |
| 1728 | } |
| 1729 | }; |
| 1730 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1731 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 1732 | /* Digital mic only available on first "ADC" */ |
| 1733 | { |
| 1734 | .num_items = 5, |
| 1735 | .items = { |
| 1736 | { "Mic", 0x0 }, |
| 1737 | { "Line", 0x2 }, |
| 1738 | { "CD", 0x4 }, |
| 1739 | { "Front Mic", 0xb }, |
| 1740 | { "Input Mix", 0xa }, |
| 1741 | }, |
| 1742 | }, |
| 1743 | { |
| 1744 | .num_items = 4, |
| 1745 | .items = { |
| 1746 | { "Mic", 0x0 }, |
| 1747 | { "Line", 0x2 }, |
| 1748 | { "CD", 0x4 }, |
| 1749 | { "Input Mix", 0xa }, |
| 1750 | }, |
| 1751 | }, |
| 1752 | { |
| 1753 | .num_items = 4, |
| 1754 | .items = { |
| 1755 | { "Mic", 0x0 }, |
| 1756 | { "Line", 0x2 }, |
| 1757 | { "CD", 0x4 }, |
| 1758 | { "Input Mix", 0xa }, |
| 1759 | }, |
| 1760 | } |
| 1761 | }; |
| 1762 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1763 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1764 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1765 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1766 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1767 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1768 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1769 | HDA_OUTPUT), |
| 1770 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1771 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1772 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1773 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1774 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1775 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1776 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1777 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1778 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1779 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1780 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1781 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1782 | { } /* end */ |
| 1783 | }; |
| 1784 | |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 1785 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
| 1786 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1787 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1788 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1789 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1790 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1791 | HDA_OUTPUT), |
| 1792 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1793 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1794 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1795 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1796 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1797 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1798 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1799 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1800 | { } /* end */ |
| 1801 | }; |
| 1802 | |
| 1803 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1804 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1805 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1806 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1807 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1808 | spec->autocfg.hp_pins[0] = 0x15; |
| 1809 | spec->autocfg.speaker_pins[0] = 0x14; |
Łukasz Wojniłowicz | 7cef4cf | 2009-11-20 12:14:35 +0100 | [diff] [blame] | 1810 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1811 | spec->autocfg.speaker_pins[2] = 0x17; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1812 | } |
| 1813 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1814 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1815 | { |
| 1816 | struct alc_spec *spec = codec->spec; |
| 1817 | |
| 1818 | spec->autocfg.hp_pins[0] = 0x15; |
| 1819 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1820 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1821 | spec->autocfg.speaker_pins[2] = 0x17; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1822 | } |
| 1823 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1824 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1825 | { |
| 1826 | struct alc_spec *spec = codec->spec; |
| 1827 | |
| 1828 | spec->autocfg.hp_pins[0] = 0x15; |
| 1829 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1830 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1831 | spec->autocfg.speaker_pins[2] = 0x1b; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1832 | } |
| 1833 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 1834 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 1835 | static void alc889_power_eapd(struct hda_codec *codec, int power) |
| 1836 | { |
| 1837 | snd_hda_codec_write(codec, 0x14, 0, |
| 1838 | AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0); |
| 1839 | snd_hda_codec_write(codec, 0x15, 0, |
| 1840 | AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0); |
| 1841 | } |
| 1842 | #endif |
| 1843 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1844 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1845 | * ALC880 3-stack model |
| 1846 | * |
| 1847 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1848 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1849 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1850 | */ |
| 1851 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1852 | static hda_nid_t alc880_dac_nids[4] = { |
| 1853 | /* front, rear, clfe, rear_surr */ |
| 1854 | 0x02, 0x05, 0x04, 0x03 |
| 1855 | }; |
| 1856 | |
| 1857 | static hda_nid_t alc880_adc_nids[3] = { |
| 1858 | /* ADC0-2 */ |
| 1859 | 0x07, 0x08, 0x09, |
| 1860 | }; |
| 1861 | |
| 1862 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1863 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1864 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1865 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1866 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1867 | /* ADC1-2 */ |
| 1868 | 0x08, 0x09, |
| 1869 | }; |
| 1870 | |
| 1871 | #define ALC880_DIGOUT_NID 0x06 |
| 1872 | #define ALC880_DIGIN_NID 0x0a |
| 1873 | |
| 1874 | static struct hda_input_mux alc880_capture_source = { |
| 1875 | .num_items = 4, |
| 1876 | .items = { |
| 1877 | { "Mic", 0x0 }, |
| 1878 | { "Front Mic", 0x3 }, |
| 1879 | { "Line", 0x2 }, |
| 1880 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1881 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1882 | }; |
| 1883 | |
| 1884 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1885 | /* 2ch mode */ |
| 1886 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1887 | /* set line-in to input, mute it */ |
| 1888 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1889 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1890 | /* set mic-in to input vref 80%, mute it */ |
| 1891 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1892 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1893 | { } /* end */ |
| 1894 | }; |
| 1895 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1896 | /* 6ch mode */ |
| 1897 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1898 | /* set line-in to output, unmute it */ |
| 1899 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1900 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1901 | /* set mic-in to output, unmute it */ |
| 1902 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1903 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1904 | { } /* end */ |
| 1905 | }; |
| 1906 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1907 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1908 | { 2, alc880_threestack_ch2_init }, |
| 1909 | { 6, alc880_threestack_ch6_init }, |
| 1910 | }; |
| 1911 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1912 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1913 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1914 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1915 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1916 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1917 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1918 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1919 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1920 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1921 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1922 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1923 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1924 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1925 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1926 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1927 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1928 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1929 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1930 | { |
| 1931 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1932 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1933 | .info = alc_ch_mode_info, |
| 1934 | .get = alc_ch_mode_get, |
| 1935 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1936 | }, |
| 1937 | { } /* end */ |
| 1938 | }; |
| 1939 | |
| 1940 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1941 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1942 | struct snd_ctl_elem_info *uinfo) |
| 1943 | { |
| 1944 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1945 | struct alc_spec *spec = codec->spec; |
| 1946 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1947 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1948 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1949 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1950 | HDA_INPUT); |
| 1951 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1952 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1953 | return err; |
| 1954 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1955 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1956 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1957 | unsigned int size, unsigned int __user *tlv) |
| 1958 | { |
| 1959 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1960 | struct alc_spec *spec = codec->spec; |
| 1961 | int err; |
| 1962 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1963 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1964 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1965 | HDA_INPUT); |
| 1966 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1967 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1968 | return err; |
| 1969 | } |
| 1970 | |
| 1971 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1972 | struct snd_ctl_elem_value *ucontrol); |
| 1973 | |
| 1974 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1975 | struct snd_ctl_elem_value *ucontrol, |
| 1976 | getput_call_t func) |
| 1977 | { |
| 1978 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1979 | struct alc_spec *spec = codec->spec; |
| 1980 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1981 | int err; |
| 1982 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1983 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1984 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1985 | 3, 0, HDA_INPUT); |
| 1986 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1987 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1988 | return err; |
| 1989 | } |
| 1990 | |
| 1991 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 1992 | struct snd_ctl_elem_value *ucontrol) |
| 1993 | { |
| 1994 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1995 | snd_hda_mixer_amp_volume_get); |
| 1996 | } |
| 1997 | |
| 1998 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 1999 | struct snd_ctl_elem_value *ucontrol) |
| 2000 | { |
| 2001 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2002 | snd_hda_mixer_amp_volume_put); |
| 2003 | } |
| 2004 | |
| 2005 | /* capture mixer elements */ |
| 2006 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 2007 | |
| 2008 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 2009 | struct snd_ctl_elem_value *ucontrol) |
| 2010 | { |
| 2011 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2012 | snd_hda_mixer_amp_switch_get); |
| 2013 | } |
| 2014 | |
| 2015 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 2016 | struct snd_ctl_elem_value *ucontrol) |
| 2017 | { |
| 2018 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2019 | snd_hda_mixer_amp_switch_put); |
| 2020 | } |
| 2021 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2022 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2023 | { \ |
| 2024 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2025 | .name = "Capture Switch", \ |
| 2026 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 2027 | .count = num, \ |
| 2028 | .info = alc_cap_sw_info, \ |
| 2029 | .get = alc_cap_sw_get, \ |
| 2030 | .put = alc_cap_sw_put, \ |
| 2031 | }, \ |
| 2032 | { \ |
| 2033 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2034 | .name = "Capture Volume", \ |
| 2035 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2036 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2037 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2038 | .count = num, \ |
| 2039 | .info = alc_cap_vol_info, \ |
| 2040 | .get = alc_cap_vol_get, \ |
| 2041 | .put = alc_cap_vol_put, \ |
| 2042 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2043 | } |
| 2044 | |
| 2045 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2046 | { \ |
| 2047 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2048 | /* .name = "Capture Source", */ \ |
| 2049 | .name = "Input Source", \ |
| 2050 | .count = num, \ |
| 2051 | .info = alc_mux_enum_info, \ |
| 2052 | .get = alc_mux_enum_get, \ |
| 2053 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2054 | } |
| 2055 | |
| 2056 | #define DEFINE_CAPMIX(num) \ |
| 2057 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2058 | _DEFINE_CAPMIX(num), \ |
| 2059 | _DEFINE_CAPSRC(num), \ |
| 2060 | { } /* end */ \ |
| 2061 | } |
| 2062 | |
| 2063 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2064 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2065 | _DEFINE_CAPMIX(num), \ |
| 2066 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2067 | } |
| 2068 | |
| 2069 | /* up to three ADCs */ |
| 2070 | DEFINE_CAPMIX(1); |
| 2071 | DEFINE_CAPMIX(2); |
| 2072 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2073 | DEFINE_CAPMIX_NOSRC(1); |
| 2074 | DEFINE_CAPMIX_NOSRC(2); |
| 2075 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2076 | |
| 2077 | /* |
| 2078 | * ALC880 5-stack model |
| 2079 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2080 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2081 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2082 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2083 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2084 | */ |
| 2085 | |
| 2086 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2087 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2088 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2089 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2090 | { } /* end */ |
| 2091 | }; |
| 2092 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2093 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2094 | /* 6ch mode */ |
| 2095 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2096 | /* set line-in to input, mute it */ |
| 2097 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2098 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2099 | { } /* end */ |
| 2100 | }; |
| 2101 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2102 | /* 8ch mode */ |
| 2103 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2104 | /* set line-in to output, unmute it */ |
| 2105 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2106 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2107 | { } /* end */ |
| 2108 | }; |
| 2109 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2110 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2111 | { 6, alc880_fivestack_ch6_init }, |
| 2112 | { 8, alc880_fivestack_ch8_init }, |
| 2113 | }; |
| 2114 | |
| 2115 | |
| 2116 | /* |
| 2117 | * ALC880 6-stack model |
| 2118 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2119 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2120 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2121 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2122 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2123 | */ |
| 2124 | |
| 2125 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2126 | /* front, rear, clfe, rear_surr */ |
| 2127 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2128 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2129 | |
| 2130 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2131 | .num_items = 4, |
| 2132 | .items = { |
| 2133 | { "Mic", 0x0 }, |
| 2134 | { "Front Mic", 0x1 }, |
| 2135 | { "Line", 0x2 }, |
| 2136 | { "CD", 0x4 }, |
| 2137 | }, |
| 2138 | }; |
| 2139 | |
| 2140 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2141 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2142 | { 8, NULL }, |
| 2143 | }; |
| 2144 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2145 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2146 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2147 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2148 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2149 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2150 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2151 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2152 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2153 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2154 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2155 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2156 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2157 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2158 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2159 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2160 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2161 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2162 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2163 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2164 | { |
| 2165 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2166 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2167 | .info = alc_ch_mode_info, |
| 2168 | .get = alc_ch_mode_get, |
| 2169 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2170 | }, |
| 2171 | { } /* end */ |
| 2172 | }; |
| 2173 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2174 | |
| 2175 | /* |
| 2176 | * ALC880 W810 model |
| 2177 | * |
| 2178 | * W810 has rear IO for: |
| 2179 | * Front (DAC 02) |
| 2180 | * Surround (DAC 03) |
| 2181 | * Center/LFE (DAC 04) |
| 2182 | * Digital out (06) |
| 2183 | * |
| 2184 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2185 | * 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] | 2186 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2187 | * There is a variable resistor to control the speaker or headphone |
| 2188 | * volume. This is a hardware-only device without a software API. |
| 2189 | * |
| 2190 | * Plugging headphones in will disable the internal speakers. This is |
| 2191 | * implemented in hardware, not via the driver using jack sense. In |
| 2192 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2193 | * disable both the speakers and headphones. |
| 2194 | * |
| 2195 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2196 | * These may not do anything useful with this driver yet, because I |
| 2197 | * haven't setup any initialization verbs for these yet... |
| 2198 | */ |
| 2199 | |
| 2200 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2201 | /* front, rear/surround, clfe */ |
| 2202 | 0x02, 0x03, 0x04 |
| 2203 | }; |
| 2204 | |
| 2205 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2206 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2207 | { 6, NULL } |
| 2208 | }; |
| 2209 | |
| 2210 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2211 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2212 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2213 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2214 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2215 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2216 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2217 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2218 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2219 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2220 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2221 | { } /* end */ |
| 2222 | }; |
| 2223 | |
| 2224 | |
| 2225 | /* |
| 2226 | * Z710V model |
| 2227 | * |
| 2228 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2229 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2230 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2231 | */ |
| 2232 | |
| 2233 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2234 | 0x02 |
| 2235 | }; |
| 2236 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2237 | |
| 2238 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2239 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2240 | { 2, NULL } |
| 2241 | }; |
| 2242 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2243 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2244 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2245 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2246 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2247 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2248 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2249 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2250 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2251 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2252 | { } /* end */ |
| 2253 | }; |
| 2254 | |
| 2255 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2256 | /* |
| 2257 | * ALC880 F1734 model |
| 2258 | * |
| 2259 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2260 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2261 | */ |
| 2262 | |
| 2263 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2264 | 0x03 |
| 2265 | }; |
| 2266 | #define ALC880_F1734_HP_DAC 0x02 |
| 2267 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2268 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2269 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2270 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2271 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2272 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2273 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2274 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2275 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2276 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2277 | { } /* end */ |
| 2278 | }; |
| 2279 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2280 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2281 | .num_items = 2, |
| 2282 | .items = { |
| 2283 | { "Mic", 0x1 }, |
| 2284 | { "CD", 0x4 }, |
| 2285 | }, |
| 2286 | }; |
| 2287 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2288 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2289 | /* |
| 2290 | * ALC880 ASUS model |
| 2291 | * |
| 2292 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2293 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2294 | * Mic = 0x18, Line = 0x1a |
| 2295 | */ |
| 2296 | |
| 2297 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2298 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2299 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2300 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2301 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2302 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2303 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2304 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2305 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2306 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2307 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2308 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2309 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2310 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2311 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2312 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2313 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2314 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2315 | { |
| 2316 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2317 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2318 | .info = alc_ch_mode_info, |
| 2319 | .get = alc_ch_mode_get, |
| 2320 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2321 | }, |
| 2322 | { } /* end */ |
| 2323 | }; |
| 2324 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2325 | /* |
| 2326 | * ALC880 ASUS W1V model |
| 2327 | * |
| 2328 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2329 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2330 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2331 | */ |
| 2332 | |
| 2333 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2334 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2335 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2336 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2337 | { } /* end */ |
| 2338 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2339 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2340 | /* TCL S700 */ |
| 2341 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2342 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2343 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2344 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2345 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2346 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2347 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2348 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2349 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2350 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2351 | { } /* end */ |
| 2352 | }; |
| 2353 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2354 | /* Uniwill */ |
| 2355 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2356 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2357 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2358 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2359 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2360 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2361 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2362 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2363 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2364 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2365 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2366 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2367 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2368 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2369 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2370 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2371 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2372 | { |
| 2373 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2374 | .name = "Channel Mode", |
| 2375 | .info = alc_ch_mode_info, |
| 2376 | .get = alc_ch_mode_get, |
| 2377 | .put = alc_ch_mode_put, |
| 2378 | }, |
| 2379 | { } /* end */ |
| 2380 | }; |
| 2381 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2382 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2383 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2384 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2385 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2386 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2387 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2388 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2389 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2390 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2391 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2392 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2393 | { } /* end */ |
| 2394 | }; |
| 2395 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2396 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2397 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2398 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2399 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2400 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2401 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2402 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2403 | { } /* end */ |
| 2404 | }; |
| 2405 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2406 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2407 | * virtual master controls |
| 2408 | */ |
| 2409 | |
| 2410 | /* |
| 2411 | * slave controls for virtual master |
| 2412 | */ |
| 2413 | static const char *alc_slave_vols[] = { |
| 2414 | "Front Playback Volume", |
| 2415 | "Surround Playback Volume", |
| 2416 | "Center Playback Volume", |
| 2417 | "LFE Playback Volume", |
| 2418 | "Side Playback Volume", |
| 2419 | "Headphone Playback Volume", |
| 2420 | "Speaker Playback Volume", |
| 2421 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2422 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2423 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2424 | NULL, |
| 2425 | }; |
| 2426 | |
| 2427 | static const char *alc_slave_sws[] = { |
| 2428 | "Front Playback Switch", |
| 2429 | "Surround Playback Switch", |
| 2430 | "Center Playback Switch", |
| 2431 | "LFE Playback Switch", |
| 2432 | "Side Playback Switch", |
| 2433 | "Headphone Playback Switch", |
| 2434 | "Speaker Playback Switch", |
| 2435 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2436 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 2437 | "Line-Out Playback Switch", |
| 2438 | "PCM Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2439 | NULL, |
| 2440 | }; |
| 2441 | |
| 2442 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2443 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2444 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2445 | |
| 2446 | static void alc_free_kctls(struct hda_codec *codec); |
| 2447 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2448 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2449 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2450 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2451 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 2452 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2453 | { } /* end */ |
| 2454 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2455 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2456 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2457 | static int alc_build_controls(struct hda_codec *codec) |
| 2458 | { |
| 2459 | struct alc_spec *spec = codec->spec; |
| 2460 | int err; |
| 2461 | int i; |
| 2462 | |
| 2463 | for (i = 0; i < spec->num_mixers; i++) { |
| 2464 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2465 | if (err < 0) |
| 2466 | return err; |
| 2467 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2468 | if (spec->cap_mixer) { |
| 2469 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2470 | if (err < 0) |
| 2471 | return err; |
| 2472 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2473 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2474 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2475 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2476 | if (err < 0) |
| 2477 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2478 | if (!spec->no_analog) { |
| 2479 | err = snd_hda_create_spdif_share_sw(codec, |
| 2480 | &spec->multiout); |
| 2481 | if (err < 0) |
| 2482 | return err; |
| 2483 | spec->multiout.share_spdif = 1; |
| 2484 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2485 | } |
| 2486 | if (spec->dig_in_nid) { |
| 2487 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2488 | if (err < 0) |
| 2489 | return err; |
| 2490 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2491 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2492 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2493 | /* create beep controls if needed */ |
| 2494 | if (spec->beep_amp) { |
| 2495 | struct snd_kcontrol_new *knew; |
| 2496 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2497 | struct snd_kcontrol *kctl; |
| 2498 | kctl = snd_ctl_new1(knew, codec); |
| 2499 | if (!kctl) |
| 2500 | return -ENOMEM; |
| 2501 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 3911a4c | 2009-11-11 13:43:01 +0100 | [diff] [blame] | 2502 | err = snd_hda_ctl_add(codec, |
| 2503 | get_amp_nid_(spec->beep_amp), kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2504 | if (err < 0) |
| 2505 | return err; |
| 2506 | } |
| 2507 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2508 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2509 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2510 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2511 | if (!spec->no_analog && |
| 2512 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2513 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2514 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2515 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2516 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2517 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2518 | if (err < 0) |
| 2519 | return err; |
| 2520 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2521 | if (!spec->no_analog && |
| 2522 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2523 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2524 | NULL, alc_slave_sws); |
| 2525 | if (err < 0) |
| 2526 | return err; |
| 2527 | } |
| 2528 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2529 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2530 | return 0; |
| 2531 | } |
| 2532 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2533 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2534 | /* |
| 2535 | * initialize the codec volumes, etc |
| 2536 | */ |
| 2537 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2538 | /* |
| 2539 | * generic initialization of ADC, input mixers and output mixers |
| 2540 | */ |
| 2541 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2542 | /* |
| 2543 | * Unmute ADC0-2 and set the default input to mic-in |
| 2544 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2545 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2546 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2547 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2548 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2549 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2550 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2551 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2552 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2553 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2554 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2555 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2556 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2557 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2558 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2559 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2560 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2561 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2562 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2563 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2564 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2565 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2566 | /* |
| 2567 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2568 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2569 | /* set vol=0 to output mixers */ |
| 2570 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2571 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2572 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2573 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2574 | /* set up input amps for analog loopback */ |
| 2575 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2576 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2577 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2578 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2579 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2580 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2581 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2582 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2583 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2584 | |
| 2585 | { } |
| 2586 | }; |
| 2587 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2588 | /* |
| 2589 | * 3-stack pin configuration: |
| 2590 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2591 | */ |
| 2592 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2593 | /* |
| 2594 | * preset connection lists of input pins |
| 2595 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2596 | */ |
| 2597 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2598 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2599 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2600 | |
| 2601 | /* |
| 2602 | * Set pin mode and muting |
| 2603 | */ |
| 2604 | /* set front pin widgets 0x14 for output */ |
| 2605 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2606 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2607 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2608 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2609 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2610 | /* Mic2 (as headphone out) for HP output */ |
| 2611 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2612 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2613 | /* Line In pin widget for input */ |
| 2614 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2615 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2616 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2617 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2618 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2619 | /* CD pin widget for input */ |
| 2620 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2621 | |
| 2622 | { } |
| 2623 | }; |
| 2624 | |
| 2625 | /* |
| 2626 | * 5-stack pin configuration: |
| 2627 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2628 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2629 | */ |
| 2630 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2631 | /* |
| 2632 | * preset connection lists of input pins |
| 2633 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2634 | */ |
| 2635 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2636 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2637 | |
| 2638 | /* |
| 2639 | * Set pin mode and muting |
| 2640 | */ |
| 2641 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2642 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2643 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2644 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2645 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2646 | /* unmute pins for output (no gain on this amp) */ |
| 2647 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2648 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2649 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2650 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2651 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2652 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2653 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2654 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2655 | /* Mic2 (as headphone out) for HP output */ |
| 2656 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2657 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2658 | /* Line In pin widget for input */ |
| 2659 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2660 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2661 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2662 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2663 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2664 | /* CD pin widget for input */ |
| 2665 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2666 | |
| 2667 | { } |
| 2668 | }; |
| 2669 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2670 | /* |
| 2671 | * W810 pin configuration: |
| 2672 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2673 | */ |
| 2674 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2675 | /* hphone/speaker input selector: front DAC */ |
| 2676 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2677 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2678 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2679 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2680 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2681 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2682 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2683 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2684 | |
| 2685 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2686 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2687 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2688 | { } |
| 2689 | }; |
| 2690 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2691 | /* |
| 2692 | * Z71V pin configuration: |
| 2693 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2694 | */ |
| 2695 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2696 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2697 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2698 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2699 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2700 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2701 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2702 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2703 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2704 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2705 | |
| 2706 | { } |
| 2707 | }; |
| 2708 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2709 | /* |
| 2710 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2711 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2712 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2713 | */ |
| 2714 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2715 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2716 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2717 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2718 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2719 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2720 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2721 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2722 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2723 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2724 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2725 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2726 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2727 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2728 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2729 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2730 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2731 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2732 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2733 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2734 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2735 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2736 | { } |
| 2737 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2738 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2739 | /* |
| 2740 | * Uniwill pin configuration: |
| 2741 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2742 | * line = 0x1a |
| 2743 | */ |
| 2744 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2745 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2746 | |
| 2747 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2748 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2749 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2750 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2751 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2752 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2753 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2754 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2755 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2756 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2757 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2758 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2759 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2760 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2761 | |
| 2762 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2763 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2764 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2765 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2766 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2767 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2768 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2769 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2770 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2771 | |
| 2772 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2773 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2774 | |
| 2775 | { } |
| 2776 | }; |
| 2777 | |
| 2778 | /* |
| 2779 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2780 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2781 | */ |
| 2782 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2783 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2784 | |
| 2785 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2786 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2787 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2788 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2789 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2790 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2791 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2792 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2793 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2794 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2795 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2796 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2797 | |
| 2798 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2799 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2800 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2801 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2802 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2803 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2804 | |
| 2805 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2806 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2807 | |
| 2808 | { } |
| 2809 | }; |
| 2810 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2811 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2812 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2813 | { } |
| 2814 | }; |
| 2815 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2816 | /* auto-toggle front mic */ |
| 2817 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2818 | { |
| 2819 | unsigned int present; |
| 2820 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2821 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 2822 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2823 | bits = present ? HDA_AMP_MUTE : 0; |
| 2824 | 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] | 2825 | } |
| 2826 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2827 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2828 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2829 | struct alc_spec *spec = codec->spec; |
| 2830 | |
| 2831 | spec->autocfg.hp_pins[0] = 0x14; |
| 2832 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2833 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2834 | } |
| 2835 | |
| 2836 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 2837 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2838 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2839 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2840 | } |
| 2841 | |
| 2842 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2843 | unsigned int res) |
| 2844 | { |
| 2845 | /* Looks like the unsol event is incompatible with the standard |
| 2846 | * definition. 4bit tag is placed at 28 bit! |
| 2847 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2848 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2849 | case ALC880_MIC_EVENT: |
| 2850 | alc880_uniwill_mic_automute(codec); |
| 2851 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2852 | default: |
| 2853 | alc_automute_amp_unsol_event(codec, res); |
| 2854 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2855 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2856 | } |
| 2857 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2858 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2859 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2860 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2861 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2862 | spec->autocfg.hp_pins[0] = 0x14; |
| 2863 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2864 | } |
| 2865 | |
| 2866 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2867 | { |
| 2868 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2869 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2870 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2871 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2872 | present &= HDA_AMP_VOLMASK; |
| 2873 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2874 | HDA_AMP_VOLMASK, present); |
| 2875 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2876 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2877 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2878 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2879 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2880 | unsigned int res) |
| 2881 | { |
| 2882 | /* Looks like the unsol event is incompatible with the standard |
| 2883 | * definition. 4bit tag is placed at 28 bit! |
| 2884 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2885 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2886 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2887 | else |
| 2888 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2889 | } |
| 2890 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2891 | /* |
| 2892 | * F1734 pin configuration: |
| 2893 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2894 | */ |
| 2895 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2896 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 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 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2906 | |
| 2907 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2908 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2909 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2910 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2911 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2912 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2913 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2914 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2915 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2916 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2917 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2918 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2919 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2920 | { } |
| 2921 | }; |
| 2922 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2923 | /* |
| 2924 | * ASUS pin configuration: |
| 2925 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2926 | */ |
| 2927 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2928 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2929 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2930 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2931 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2932 | |
| 2933 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2934 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2935 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2936 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2937 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2938 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2939 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2940 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2941 | |
| 2942 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2943 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2944 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2945 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2946 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2947 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2948 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2949 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2950 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2951 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2952 | { } |
| 2953 | }; |
| 2954 | |
| 2955 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2956 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2957 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 2958 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2959 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2960 | /* Clevo m520g init */ |
| 2961 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2962 | /* headphone output */ |
| 2963 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2964 | /* line-out */ |
| 2965 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2966 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2967 | /* Line-in */ |
| 2968 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2969 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2970 | /* CD */ |
| 2971 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2972 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2973 | /* Mic1 (rear panel) */ |
| 2974 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2975 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2976 | /* Mic2 (front panel) */ |
| 2977 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2978 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2979 | /* headphone */ |
| 2980 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2981 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2982 | /* change to EAPD mode */ |
| 2983 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2984 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2985 | |
| 2986 | { } |
| 2987 | }; |
| 2988 | |
| 2989 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2990 | /* change to EAPD mode */ |
| 2991 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2992 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2993 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2994 | /* Headphone output */ |
| 2995 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2996 | /* Front output*/ |
| 2997 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2998 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2999 | |
| 3000 | /* Line In pin widget for input */ |
| 3001 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3002 | /* CD pin widget for input */ |
| 3003 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3004 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3005 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3006 | |
| 3007 | /* change to EAPD mode */ |
| 3008 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3009 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 3010 | |
| 3011 | { } |
| 3012 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3013 | |
| 3014 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3015 | * LG m1 express dual |
| 3016 | * |
| 3017 | * Pin assignment: |
| 3018 | * Rear Line-In/Out (blue): 0x14 |
| 3019 | * Build-in Mic-In: 0x15 |
| 3020 | * Speaker-out: 0x17 |
| 3021 | * HP-Out (green): 0x1b |
| 3022 | * Mic-In/Out (red): 0x19 |
| 3023 | * SPDIF-Out: 0x1e |
| 3024 | */ |
| 3025 | |
| 3026 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 3027 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 3028 | 0x05, 0x02, 0x03 |
| 3029 | }; |
| 3030 | |
| 3031 | /* seems analog CD is not working */ |
| 3032 | static struct hda_input_mux alc880_lg_capture_source = { |
| 3033 | .num_items = 3, |
| 3034 | .items = { |
| 3035 | { "Mic", 0x1 }, |
| 3036 | { "Line", 0x5 }, |
| 3037 | { "Internal Mic", 0x6 }, |
| 3038 | }, |
| 3039 | }; |
| 3040 | |
| 3041 | /* 2,4,6 channel modes */ |
| 3042 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 3043 | /* set line-in and mic-in to input */ |
| 3044 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3045 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3046 | { } |
| 3047 | }; |
| 3048 | |
| 3049 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 3050 | /* set line-in to out and mic-in to input */ |
| 3051 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3052 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3053 | { } |
| 3054 | }; |
| 3055 | |
| 3056 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3057 | /* set line-in and mic-in to output */ |
| 3058 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3059 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3060 | { } |
| 3061 | }; |
| 3062 | |
| 3063 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3064 | { 2, alc880_lg_ch2_init }, |
| 3065 | { 4, alc880_lg_ch4_init }, |
| 3066 | { 6, alc880_lg_ch6_init }, |
| 3067 | }; |
| 3068 | |
| 3069 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3070 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3071 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3072 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3073 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3074 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3075 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3076 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3077 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3078 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3079 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3080 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3081 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3082 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3083 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3084 | { |
| 3085 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3086 | .name = "Channel Mode", |
| 3087 | .info = alc_ch_mode_info, |
| 3088 | .get = alc_ch_mode_get, |
| 3089 | .put = alc_ch_mode_put, |
| 3090 | }, |
| 3091 | { } /* end */ |
| 3092 | }; |
| 3093 | |
| 3094 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3095 | /* set capture source to mic-in */ |
| 3096 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3097 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3098 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3099 | /* mute all amp mixer inputs */ |
| 3100 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3101 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3102 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3103 | /* line-in to input */ |
| 3104 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3105 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3106 | /* built-in mic */ |
| 3107 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3108 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3109 | /* speaker-out */ |
| 3110 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3111 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3112 | /* mic-in to input */ |
| 3113 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3114 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3115 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3116 | /* HP-out */ |
| 3117 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3118 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3119 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3120 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3121 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3122 | { } |
| 3123 | }; |
| 3124 | |
| 3125 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3126 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3127 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3128 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3129 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3130 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3131 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3132 | } |
| 3133 | |
| 3134 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3135 | * LG LW20 |
| 3136 | * |
| 3137 | * Pin assignment: |
| 3138 | * Speaker-out: 0x14 |
| 3139 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3140 | * Built-in Mic-In: 0x19 |
| 3141 | * Line-In: 0x1b |
| 3142 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3143 | * SPDIF-Out: 0x1e |
| 3144 | */ |
| 3145 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3146 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3147 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3148 | .items = { |
| 3149 | { "Mic", 0x0 }, |
| 3150 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3151 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3152 | }, |
| 3153 | }; |
| 3154 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3155 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3156 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3157 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3158 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3159 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3160 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3161 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3162 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3163 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3164 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3165 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3166 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3167 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3168 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3169 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3170 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3171 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3172 | { |
| 3173 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3174 | .name = "Channel Mode", |
| 3175 | .info = alc_ch_mode_info, |
| 3176 | .get = alc_ch_mode_get, |
| 3177 | .put = alc_ch_mode_put, |
| 3178 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3179 | { } /* end */ |
| 3180 | }; |
| 3181 | |
| 3182 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3183 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3184 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3185 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3186 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3187 | /* set capture source to mic-in */ |
| 3188 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3189 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3190 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3191 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3192 | /* speaker-out */ |
| 3193 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3194 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3195 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3196 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3197 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3198 | /* mic-in to input */ |
| 3199 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3200 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3201 | /* built-in mic */ |
| 3202 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3203 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3204 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3205 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3206 | { } |
| 3207 | }; |
| 3208 | |
| 3209 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3210 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3211 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3212 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3213 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3214 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3215 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3216 | } |
| 3217 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3218 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3219 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3220 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3221 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3222 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3223 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3224 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3225 | { } /* end */ |
| 3226 | }; |
| 3227 | |
| 3228 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3229 | .num_items = 2, |
| 3230 | .items = { |
| 3231 | { "Mic", 0x0 }, |
| 3232 | { "Internal Mic", 0x1 }, |
| 3233 | }, |
| 3234 | }; |
| 3235 | |
| 3236 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3237 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3238 | |
| 3239 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3240 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3241 | |
| 3242 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3243 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3244 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3245 | /* Mic2 (as headphone out) for HP output */ |
| 3246 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3247 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3248 | /* Internal Speaker */ |
| 3249 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3250 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3251 | |
| 3252 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3253 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3254 | |
| 3255 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3256 | { } |
| 3257 | }; |
| 3258 | |
| 3259 | /* toggle speaker-output according to the hp-jack state */ |
| 3260 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3261 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3262 | struct alc_spec *spec = codec->spec; |
| 3263 | alc_automute_amp(codec); |
| 3264 | /* toggle EAPD */ |
| 3265 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3266 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3267 | else |
| 3268 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3269 | } |
| 3270 | |
| 3271 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3272 | unsigned int res) |
| 3273 | { |
| 3274 | /* Looks like the unsol event is incompatible with the standard |
| 3275 | * definition. 4bit tag is placed at 28 bit! |
| 3276 | */ |
| 3277 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3278 | alc880_medion_rim_automute(codec); |
| 3279 | } |
| 3280 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3281 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3282 | { |
| 3283 | struct alc_spec *spec = codec->spec; |
| 3284 | |
| 3285 | spec->autocfg.hp_pins[0] = 0x14; |
| 3286 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3287 | } |
| 3288 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3289 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3290 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3291 | { 0x0b, HDA_INPUT, 0 }, |
| 3292 | { 0x0b, HDA_INPUT, 1 }, |
| 3293 | { 0x0b, HDA_INPUT, 2 }, |
| 3294 | { 0x0b, HDA_INPUT, 3 }, |
| 3295 | { 0x0b, HDA_INPUT, 4 }, |
| 3296 | { } /* end */ |
| 3297 | }; |
| 3298 | |
| 3299 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3300 | { 0x0b, HDA_INPUT, 1 }, |
| 3301 | { 0x0b, HDA_INPUT, 6 }, |
| 3302 | { 0x0b, HDA_INPUT, 7 }, |
| 3303 | { } /* end */ |
| 3304 | }; |
| 3305 | #endif |
| 3306 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3307 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3308 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3309 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3310 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3311 | static int alc_init(struct hda_codec *codec) |
| 3312 | { |
| 3313 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3314 | unsigned int i; |
| 3315 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3316 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3317 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3318 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3319 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3320 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3321 | |
| 3322 | if (spec->init_hook) |
| 3323 | spec->init_hook(codec); |
| 3324 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3325 | return 0; |
| 3326 | } |
| 3327 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3328 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3329 | { |
| 3330 | struct alc_spec *spec = codec->spec; |
| 3331 | |
| 3332 | if (spec->unsol_event) |
| 3333 | spec->unsol_event(codec, res); |
| 3334 | } |
| 3335 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3336 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3337 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3338 | { |
| 3339 | struct alc_spec *spec = codec->spec; |
| 3340 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3341 | } |
| 3342 | #endif |
| 3343 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3344 | /* |
| 3345 | * Analog playback callbacks |
| 3346 | */ |
| 3347 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3348 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 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; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3352 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3353 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3354 | } |
| 3355 | |
| 3356 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3357 | struct hda_codec *codec, |
| 3358 | unsigned int stream_tag, |
| 3359 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3360 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3361 | { |
| 3362 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3363 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3364 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3365 | } |
| 3366 | |
| 3367 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3368 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3369 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3370 | { |
| 3371 | struct alc_spec *spec = codec->spec; |
| 3372 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3373 | } |
| 3374 | |
| 3375 | /* |
| 3376 | * Digital out |
| 3377 | */ |
| 3378 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3379 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3380 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3381 | { |
| 3382 | struct alc_spec *spec = codec->spec; |
| 3383 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3384 | } |
| 3385 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3386 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3387 | struct hda_codec *codec, |
| 3388 | unsigned int stream_tag, |
| 3389 | unsigned int format, |
| 3390 | struct snd_pcm_substream *substream) |
| 3391 | { |
| 3392 | struct alc_spec *spec = codec->spec; |
| 3393 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3394 | stream_tag, format, substream); |
| 3395 | } |
| 3396 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3397 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3398 | struct hda_codec *codec, |
| 3399 | struct snd_pcm_substream *substream) |
| 3400 | { |
| 3401 | struct alc_spec *spec = codec->spec; |
| 3402 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3403 | } |
| 3404 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3405 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3406 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3407 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3408 | { |
| 3409 | struct alc_spec *spec = codec->spec; |
| 3410 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3411 | } |
| 3412 | |
| 3413 | /* |
| 3414 | * Analog capture |
| 3415 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3416 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3417 | struct hda_codec *codec, |
| 3418 | unsigned int stream_tag, |
| 3419 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3420 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3421 | { |
| 3422 | struct alc_spec *spec = codec->spec; |
| 3423 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3424 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3425 | stream_tag, 0, format); |
| 3426 | return 0; |
| 3427 | } |
| 3428 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3429 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3430 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3431 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3432 | { |
| 3433 | struct alc_spec *spec = codec->spec; |
| 3434 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3435 | snd_hda_codec_cleanup_stream(codec, |
| 3436 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3437 | return 0; |
| 3438 | } |
| 3439 | |
| 3440 | |
| 3441 | /* |
| 3442 | */ |
| 3443 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3444 | .substreams = 1, |
| 3445 | .channels_min = 2, |
| 3446 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3447 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3448 | .ops = { |
| 3449 | .open = alc880_playback_pcm_open, |
| 3450 | .prepare = alc880_playback_pcm_prepare, |
| 3451 | .cleanup = alc880_playback_pcm_cleanup |
| 3452 | }, |
| 3453 | }; |
| 3454 | |
| 3455 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3456 | .substreams = 1, |
| 3457 | .channels_min = 2, |
| 3458 | .channels_max = 2, |
| 3459 | /* NID is set in alc_build_pcms */ |
| 3460 | }; |
| 3461 | |
| 3462 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3463 | .substreams = 1, |
| 3464 | .channels_min = 2, |
| 3465 | .channels_max = 2, |
| 3466 | /* NID is set in alc_build_pcms */ |
| 3467 | }; |
| 3468 | |
| 3469 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3470 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3471 | .channels_min = 2, |
| 3472 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3473 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3474 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3475 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3476 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3477 | }, |
| 3478 | }; |
| 3479 | |
| 3480 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3481 | .substreams = 1, |
| 3482 | .channels_min = 2, |
| 3483 | .channels_max = 2, |
| 3484 | /* NID is set in alc_build_pcms */ |
| 3485 | .ops = { |
| 3486 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3487 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3488 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3489 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3490 | }, |
| 3491 | }; |
| 3492 | |
| 3493 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3494 | .substreams = 1, |
| 3495 | .channels_min = 2, |
| 3496 | .channels_max = 2, |
| 3497 | /* NID is set in alc_build_pcms */ |
| 3498 | }; |
| 3499 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3500 | /* 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] | 3501 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3502 | .substreams = 0, |
| 3503 | .channels_min = 0, |
| 3504 | .channels_max = 0, |
| 3505 | }; |
| 3506 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3507 | static int alc_build_pcms(struct hda_codec *codec) |
| 3508 | { |
| 3509 | struct alc_spec *spec = codec->spec; |
| 3510 | struct hda_pcm *info = spec->pcm_rec; |
| 3511 | int i; |
| 3512 | |
| 3513 | codec->num_pcms = 1; |
| 3514 | codec->pcm_info = info; |
| 3515 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3516 | if (spec->no_analog) |
| 3517 | goto skip_analog; |
| 3518 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3519 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 3520 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3521 | info->name = spec->stream_name_analog; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 3522 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3523 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3524 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3525 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3526 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3527 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3528 | } |
| 3529 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3530 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3531 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3532 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3533 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3534 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3535 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3536 | if (spec->channel_mode) { |
| 3537 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3538 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3539 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3540 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3541 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3542 | } |
| 3543 | } |
| 3544 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3545 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3546 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3547 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3548 | snprintf(spec->stream_name_digital, |
| 3549 | sizeof(spec->stream_name_digital), |
| 3550 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3551 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3552 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3553 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3554 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3555 | if (spec->dig_out_type) |
| 3556 | info->pcm_type = spec->dig_out_type; |
| 3557 | else |
| 3558 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3559 | if (spec->multiout.dig_out_nid && |
| 3560 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3561 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3562 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3563 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3564 | if (spec->dig_in_nid && |
| 3565 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3566 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3567 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3568 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3569 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3570 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3571 | } |
| 3572 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3573 | if (spec->no_analog) |
| 3574 | return 0; |
| 3575 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3576 | /* If the use of more than one ADC is requested for the current |
| 3577 | * model, configure a second analog capture-only PCM. |
| 3578 | */ |
| 3579 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3580 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3581 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3582 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3583 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3584 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3585 | if (spec->alt_dac_nid) { |
| 3586 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3587 | *spec->stream_analog_alt_playback; |
| 3588 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3589 | spec->alt_dac_nid; |
| 3590 | } else { |
| 3591 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3592 | alc_pcm_null_stream; |
| 3593 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3594 | } |
| 3595 | if (spec->num_adc_nids > 1) { |
| 3596 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3597 | *spec->stream_analog_alt_capture; |
| 3598 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3599 | spec->adc_nids[1]; |
| 3600 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3601 | spec->num_adc_nids - 1; |
| 3602 | } else { |
| 3603 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3604 | alc_pcm_null_stream; |
| 3605 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3606 | } |
| 3607 | } |
| 3608 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3609 | return 0; |
| 3610 | } |
| 3611 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3612 | static void alc_free_kctls(struct hda_codec *codec) |
| 3613 | { |
| 3614 | struct alc_spec *spec = codec->spec; |
| 3615 | |
| 3616 | if (spec->kctls.list) { |
| 3617 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3618 | int i; |
| 3619 | for (i = 0; i < spec->kctls.used; i++) |
| 3620 | kfree(kctl[i].name); |
| 3621 | } |
| 3622 | snd_array_free(&spec->kctls); |
| 3623 | } |
| 3624 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3625 | static void alc_free(struct hda_codec *codec) |
| 3626 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3627 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3628 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3629 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3630 | return; |
| 3631 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3632 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3633 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3634 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3635 | } |
| 3636 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3637 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3638 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
| 3639 | { |
| 3640 | struct alc_spec *spec = codec->spec; |
| 3641 | if (spec && spec->power_hook) |
| 3642 | spec->power_hook(codec, 0); |
| 3643 | return 0; |
| 3644 | } |
| 3645 | #endif |
| 3646 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3647 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3648 | static int alc_resume(struct hda_codec *codec) |
| 3649 | { |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3650 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3651 | struct alc_spec *spec = codec->spec; |
| 3652 | #endif |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3653 | codec->patch_ops.init(codec); |
| 3654 | snd_hda_codec_resume_amp(codec); |
| 3655 | snd_hda_codec_resume_cache(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3656 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3657 | if (spec && spec->power_hook) |
| 3658 | spec->power_hook(codec, 1); |
| 3659 | #endif |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3660 | return 0; |
| 3661 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3662 | #endif |
| 3663 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3664 | /* |
| 3665 | */ |
| 3666 | static struct hda_codec_ops alc_patch_ops = { |
| 3667 | .build_controls = alc_build_controls, |
| 3668 | .build_pcms = alc_build_pcms, |
| 3669 | .init = alc_init, |
| 3670 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3671 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3672 | #ifdef SND_HDA_NEEDS_RESUME |
| 3673 | .resume = alc_resume, |
| 3674 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3675 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3676 | .suspend = alc_suspend, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3677 | .check_power_status = alc_check_power_status, |
| 3678 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3679 | }; |
| 3680 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3681 | |
| 3682 | /* |
| 3683 | * Test configuration for debugging |
| 3684 | * |
| 3685 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3686 | * enum controls. |
| 3687 | */ |
| 3688 | #ifdef CONFIG_SND_DEBUG |
| 3689 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3690 | 0x02, 0x03, 0x04, 0x05 |
| 3691 | }; |
| 3692 | |
| 3693 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3694 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3695 | .items = { |
| 3696 | { "In-1", 0x0 }, |
| 3697 | { "In-2", 0x1 }, |
| 3698 | { "In-3", 0x2 }, |
| 3699 | { "In-4", 0x3 }, |
| 3700 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3701 | { "Front", 0x5 }, |
| 3702 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3703 | }, |
| 3704 | }; |
| 3705 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3706 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3707 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3708 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3709 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3710 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3711 | }; |
| 3712 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3713 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3714 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3715 | { |
| 3716 | static char *texts[] = { |
| 3717 | "N/A", "Line Out", "HP Out", |
| 3718 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3719 | }; |
| 3720 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3721 | uinfo->count = 1; |
| 3722 | uinfo->value.enumerated.items = 8; |
| 3723 | if (uinfo->value.enumerated.item >= 8) |
| 3724 | uinfo->value.enumerated.item = 7; |
| 3725 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3726 | return 0; |
| 3727 | } |
| 3728 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3729 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3730 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3731 | { |
| 3732 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3733 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3734 | unsigned int pin_ctl, item = 0; |
| 3735 | |
| 3736 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3737 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3738 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3739 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3740 | item = 2; |
| 3741 | else |
| 3742 | item = 1; |
| 3743 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3744 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3745 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3746 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3747 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3748 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3749 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3750 | } |
| 3751 | } |
| 3752 | ucontrol->value.enumerated.item[0] = item; |
| 3753 | return 0; |
| 3754 | } |
| 3755 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3756 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3757 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3758 | { |
| 3759 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3760 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3761 | static unsigned int ctls[] = { |
| 3762 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3763 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3764 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3765 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3766 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3767 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3768 | }; |
| 3769 | unsigned int old_ctl, new_ctl; |
| 3770 | |
| 3771 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3772 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3773 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3774 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3775 | int val; |
| 3776 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3777 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3778 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3779 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3780 | HDA_AMP_MUTE : 0; |
| 3781 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3782 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3783 | return 1; |
| 3784 | } |
| 3785 | return 0; |
| 3786 | } |
| 3787 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3788 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3789 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3790 | { |
| 3791 | static char *texts[] = { |
| 3792 | "Front", "Surround", "CLFE", "Side" |
| 3793 | }; |
| 3794 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3795 | uinfo->count = 1; |
| 3796 | uinfo->value.enumerated.items = 4; |
| 3797 | if (uinfo->value.enumerated.item >= 4) |
| 3798 | uinfo->value.enumerated.item = 3; |
| 3799 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3800 | return 0; |
| 3801 | } |
| 3802 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3803 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3804 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3805 | { |
| 3806 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3807 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3808 | unsigned int sel; |
| 3809 | |
| 3810 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3811 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3812 | return 0; |
| 3813 | } |
| 3814 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3815 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3816 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3817 | { |
| 3818 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3819 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3820 | unsigned int sel; |
| 3821 | |
| 3822 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3823 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3824 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3825 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3826 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3827 | return 1; |
| 3828 | } |
| 3829 | return 0; |
| 3830 | } |
| 3831 | |
| 3832 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3833 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3834 | .name = xname, \ |
| 3835 | .info = alc_test_pin_ctl_info, \ |
| 3836 | .get = alc_test_pin_ctl_get, \ |
| 3837 | .put = alc_test_pin_ctl_put, \ |
| 3838 | .private_value = nid \ |
| 3839 | } |
| 3840 | |
| 3841 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3842 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3843 | .name = xname, \ |
| 3844 | .info = alc_test_pin_src_info, \ |
| 3845 | .get = alc_test_pin_src_get, \ |
| 3846 | .put = alc_test_pin_src_put, \ |
| 3847 | .private_value = nid \ |
| 3848 | } |
| 3849 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3850 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3851 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3852 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3853 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3854 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3855 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3856 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3857 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3858 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3859 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3860 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3861 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3862 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3863 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3864 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3865 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3866 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3867 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3868 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3869 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3870 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3871 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3872 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3873 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3874 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3875 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3876 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3877 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3878 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3879 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3880 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3881 | { |
| 3882 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3883 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3884 | .info = alc_ch_mode_info, |
| 3885 | .get = alc_ch_mode_get, |
| 3886 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3887 | }, |
| 3888 | { } /* end */ |
| 3889 | }; |
| 3890 | |
| 3891 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3892 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3893 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3894 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3895 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3896 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3897 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3898 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3899 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3900 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3901 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3902 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3903 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3904 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3905 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3906 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3907 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3908 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3909 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3910 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3911 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3912 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3913 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3914 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3915 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3916 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3917 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3918 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3919 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3920 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3921 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3922 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3923 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3924 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3925 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3926 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3927 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3928 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3929 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3930 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3931 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3932 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3933 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3934 | /* Analog input/passthru */ |
| 3935 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3936 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3937 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3938 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3939 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3940 | { } |
| 3941 | }; |
| 3942 | #endif |
| 3943 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3944 | /* |
| 3945 | */ |
| 3946 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3947 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3948 | [ALC880_3ST] = "3stack", |
| 3949 | [ALC880_TCL_S700] = "tcl", |
| 3950 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3951 | [ALC880_CLEVO] = "clevo", |
| 3952 | [ALC880_5ST] = "5stack", |
| 3953 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3954 | [ALC880_W810] = "w810", |
| 3955 | [ALC880_Z71V] = "z71v", |
| 3956 | [ALC880_6ST] = "6stack", |
| 3957 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3958 | [ALC880_ASUS] = "asus", |
| 3959 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3960 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3961 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3962 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3963 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3964 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3965 | [ALC880_F1734] = "F1734", |
| 3966 | [ALC880_LG] = "lg", |
| 3967 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3968 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3969 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3970 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3971 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3972 | [ALC880_AUTO] = "auto", |
| 3973 | }; |
| 3974 | |
| 3975 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3976 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3977 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3978 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3979 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3980 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3981 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3982 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3983 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3984 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3985 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3986 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3987 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3988 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3989 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3990 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3991 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3992 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3993 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3994 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3995 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3996 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3997 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3998 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3999 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 4000 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4001 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4002 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4003 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 4004 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4005 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 4006 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4007 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 4008 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 4009 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 4010 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4011 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 4012 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4013 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4014 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4015 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4016 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4017 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 4018 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4019 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4020 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4021 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4022 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4023 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 4024 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4025 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4026 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4027 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4028 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 4029 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4030 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4031 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 4032 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 4033 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 4034 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4035 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 4036 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4037 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4038 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4039 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 4040 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4041 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 4042 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 4043 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4044 | /* default Intel */ |
| 4045 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4046 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 4047 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4048 | {} |
| 4049 | }; |
| 4050 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4051 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4052 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4053 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4054 | static struct alc_config_preset alc880_presets[] = { |
| 4055 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4056 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4057 | .init_verbs = { alc880_volume_init_verbs, |
| 4058 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4059 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4060 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4061 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4062 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4063 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4064 | .input_mux = &alc880_capture_source, |
| 4065 | }, |
| 4066 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4067 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4068 | .init_verbs = { alc880_volume_init_verbs, |
| 4069 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4070 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4071 | .dac_nids = alc880_dac_nids, |
| 4072 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4073 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4074 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4075 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4076 | .input_mux = &alc880_capture_source, |
| 4077 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4078 | [ALC880_TCL_S700] = { |
| 4079 | .mixers = { alc880_tcl_s700_mixer }, |
| 4080 | .init_verbs = { alc880_volume_init_verbs, |
| 4081 | alc880_pin_tcl_S700_init_verbs, |
| 4082 | alc880_gpio2_init_verbs }, |
| 4083 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4084 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4085 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4086 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4087 | .hp_nid = 0x03, |
| 4088 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4089 | .channel_mode = alc880_2_jack_modes, |
| 4090 | .input_mux = &alc880_capture_source, |
| 4091 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4092 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4093 | .mixers = { alc880_three_stack_mixer, |
| 4094 | alc880_five_stack_mixer}, |
| 4095 | .init_verbs = { alc880_volume_init_verbs, |
| 4096 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4097 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4098 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4099 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4100 | .channel_mode = alc880_fivestack_modes, |
| 4101 | .input_mux = &alc880_capture_source, |
| 4102 | }, |
| 4103 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4104 | .mixers = { alc880_three_stack_mixer, |
| 4105 | alc880_five_stack_mixer }, |
| 4106 | .init_verbs = { alc880_volume_init_verbs, |
| 4107 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4108 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4109 | .dac_nids = alc880_dac_nids, |
| 4110 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4111 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4112 | .channel_mode = alc880_fivestack_modes, |
| 4113 | .input_mux = &alc880_capture_source, |
| 4114 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4115 | [ALC880_6ST] = { |
| 4116 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4117 | .init_verbs = { alc880_volume_init_verbs, |
| 4118 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4119 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4120 | .dac_nids = alc880_6st_dac_nids, |
| 4121 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4122 | .channel_mode = alc880_sixstack_modes, |
| 4123 | .input_mux = &alc880_6stack_capture_source, |
| 4124 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4125 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4126 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4127 | .init_verbs = { alc880_volume_init_verbs, |
| 4128 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4129 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4130 | .dac_nids = alc880_6st_dac_nids, |
| 4131 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4132 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4133 | .channel_mode = alc880_sixstack_modes, |
| 4134 | .input_mux = &alc880_6stack_capture_source, |
| 4135 | }, |
| 4136 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4137 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4138 | .init_verbs = { alc880_volume_init_verbs, |
| 4139 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4140 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4141 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4142 | .dac_nids = alc880_w810_dac_nids, |
| 4143 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4144 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4145 | .channel_mode = alc880_w810_modes, |
| 4146 | .input_mux = &alc880_capture_source, |
| 4147 | }, |
| 4148 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4149 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4150 | .init_verbs = { alc880_volume_init_verbs, |
| 4151 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4152 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4153 | .dac_nids = alc880_z71v_dac_nids, |
| 4154 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4155 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4156 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4157 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4158 | .input_mux = &alc880_capture_source, |
| 4159 | }, |
| 4160 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4161 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4162 | .init_verbs = { alc880_volume_init_verbs, |
| 4163 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4164 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4165 | .dac_nids = alc880_f1734_dac_nids, |
| 4166 | .hp_nid = 0x02, |
| 4167 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4168 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4169 | .input_mux = &alc880_f1734_capture_source, |
| 4170 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4171 | .setup = alc880_uniwill_p53_setup, |
| 4172 | .init_hook = alc_automute_amp, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4173 | }, |
| 4174 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4175 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4176 | .init_verbs = { alc880_volume_init_verbs, |
| 4177 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4178 | alc880_gpio1_init_verbs }, |
| 4179 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4180 | .dac_nids = alc880_asus_dac_nids, |
| 4181 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4182 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4183 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4184 | .input_mux = &alc880_capture_source, |
| 4185 | }, |
| 4186 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4187 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4188 | .init_verbs = { alc880_volume_init_verbs, |
| 4189 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4190 | alc880_gpio1_init_verbs }, |
| 4191 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4192 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4193 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4194 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4195 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4196 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4197 | .input_mux = &alc880_capture_source, |
| 4198 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4199 | [ALC880_ASUS_DIG2] = { |
| 4200 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4201 | .init_verbs = { alc880_volume_init_verbs, |
| 4202 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4203 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4204 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4205 | .dac_nids = alc880_asus_dac_nids, |
| 4206 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4207 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4208 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4209 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4210 | .input_mux = &alc880_capture_source, |
| 4211 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4212 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4213 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4214 | .init_verbs = { alc880_volume_init_verbs, |
| 4215 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4216 | alc880_gpio1_init_verbs }, |
| 4217 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4218 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4219 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4220 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4221 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4222 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4223 | .input_mux = &alc880_capture_source, |
| 4224 | }, |
| 4225 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4226 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4227 | .init_verbs = { alc880_volume_init_verbs, |
| 4228 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4229 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4230 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4231 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4232 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4233 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4234 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4235 | .input_mux = &alc880_capture_source, |
| 4236 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4237 | [ALC880_UNIWILL] = { |
| 4238 | .mixers = { alc880_uniwill_mixer }, |
| 4239 | .init_verbs = { alc880_volume_init_verbs, |
| 4240 | alc880_uniwill_init_verbs }, |
| 4241 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4242 | .dac_nids = alc880_asus_dac_nids, |
| 4243 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4244 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4245 | .channel_mode = alc880_threestack_modes, |
| 4246 | .need_dac_fix = 1, |
| 4247 | .input_mux = &alc880_capture_source, |
| 4248 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4249 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4250 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4251 | }, |
| 4252 | [ALC880_UNIWILL_P53] = { |
| 4253 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4254 | .init_verbs = { alc880_volume_init_verbs, |
| 4255 | alc880_uniwill_p53_init_verbs }, |
| 4256 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4257 | .dac_nids = alc880_asus_dac_nids, |
| 4258 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4259 | .channel_mode = alc880_threestack_modes, |
| 4260 | .input_mux = &alc880_capture_source, |
| 4261 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4262 | .setup = alc880_uniwill_p53_setup, |
| 4263 | .init_hook = alc_automute_amp, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4264 | }, |
| 4265 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4266 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4267 | .init_verbs = { alc880_volume_init_verbs, |
| 4268 | alc880_uniwill_p53_init_verbs, |
| 4269 | alc880_beep_init_verbs }, |
| 4270 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4271 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4272 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4273 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4274 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4275 | .input_mux = &alc880_capture_source, |
| 4276 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4277 | .setup = alc880_uniwill_p53_setup, |
| 4278 | .init_hook = alc_automute_amp, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4279 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4280 | [ALC880_CLEVO] = { |
| 4281 | .mixers = { alc880_three_stack_mixer }, |
| 4282 | .init_verbs = { alc880_volume_init_verbs, |
| 4283 | alc880_pin_clevo_init_verbs }, |
| 4284 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4285 | .dac_nids = alc880_dac_nids, |
| 4286 | .hp_nid = 0x03, |
| 4287 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4288 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4289 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4290 | .input_mux = &alc880_capture_source, |
| 4291 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4292 | [ALC880_LG] = { |
| 4293 | .mixers = { alc880_lg_mixer }, |
| 4294 | .init_verbs = { alc880_volume_init_verbs, |
| 4295 | alc880_lg_init_verbs }, |
| 4296 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4297 | .dac_nids = alc880_lg_dac_nids, |
| 4298 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4299 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4300 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4301 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4302 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4303 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4304 | .setup = alc880_lg_setup, |
| 4305 | .init_hook = alc_automute_amp, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4306 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4307 | .loopbacks = alc880_lg_loopbacks, |
| 4308 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4309 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4310 | [ALC880_LG_LW] = { |
| 4311 | .mixers = { alc880_lg_lw_mixer }, |
| 4312 | .init_verbs = { alc880_volume_init_verbs, |
| 4313 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4314 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4315 | .dac_nids = alc880_dac_nids, |
| 4316 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4317 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4318 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4319 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4320 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4321 | .setup = alc880_lg_lw_setup, |
| 4322 | .init_hook = alc_automute_amp, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4323 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4324 | [ALC880_MEDION_RIM] = { |
| 4325 | .mixers = { alc880_medion_rim_mixer }, |
| 4326 | .init_verbs = { alc880_volume_init_verbs, |
| 4327 | alc880_medion_rim_init_verbs, |
| 4328 | alc_gpio2_init_verbs }, |
| 4329 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4330 | .dac_nids = alc880_dac_nids, |
| 4331 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4332 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4333 | .channel_mode = alc880_2_jack_modes, |
| 4334 | .input_mux = &alc880_medion_rim_capture_source, |
| 4335 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4336 | .setup = alc880_medion_rim_setup, |
| 4337 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4338 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4339 | #ifdef CONFIG_SND_DEBUG |
| 4340 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4341 | .mixers = { alc880_test_mixer }, |
| 4342 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4343 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4344 | .dac_nids = alc880_test_dac_nids, |
| 4345 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4346 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4347 | .channel_mode = alc880_test_modes, |
| 4348 | .input_mux = &alc880_test_capture_source, |
| 4349 | }, |
| 4350 | #endif |
| 4351 | }; |
| 4352 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4353 | /* |
| 4354 | * Automatic parse of I/O pins from the BIOS configuration |
| 4355 | */ |
| 4356 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4357 | enum { |
| 4358 | ALC_CTL_WIDGET_VOL, |
| 4359 | ALC_CTL_WIDGET_MUTE, |
| 4360 | ALC_CTL_BIND_MUTE, |
| 4361 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4362 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4363 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4364 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4365 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4366 | }; |
| 4367 | |
| 4368 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4369 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 4370 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4371 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4372 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4373 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4374 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4375 | knew = snd_array_new(&spec->kctls); |
| 4376 | if (!knew) |
| 4377 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4378 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4379 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4380 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4381 | return -ENOMEM; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 4382 | if (get_amp_nid_(val)) |
Takashi Iwai | 9c96fa5 | 2009-11-16 11:25:33 +0100 | [diff] [blame] | 4383 | knew->subdevice = HDA_SUBDEV_NID_FLAG | get_amp_nid_(val); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4384 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4385 | return 0; |
| 4386 | } |
| 4387 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4388 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 4389 | const char *pfx, const char *dir, |
| 4390 | const char *sfx, unsigned long val) |
| 4391 | { |
| 4392 | char name[32]; |
| 4393 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
| 4394 | return add_control(spec, type, name, val); |
| 4395 | } |
| 4396 | |
| 4397 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 4398 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val) |
| 4399 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 4400 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val) |
| 4401 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4402 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4403 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4404 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4405 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4406 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4407 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4408 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4409 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4410 | #define ALC880_PIN_CD_NID 0x1c |
| 4411 | |
| 4412 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4413 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4414 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4415 | { |
| 4416 | hda_nid_t nid; |
| 4417 | int assigned[4]; |
| 4418 | int i, j; |
| 4419 | |
| 4420 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4421 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4422 | |
| 4423 | /* check the pins hardwired to audio widget */ |
| 4424 | for (i = 0; i < cfg->line_outs; i++) { |
| 4425 | nid = cfg->line_out_pins[i]; |
| 4426 | if (alc880_is_fixed_pin(nid)) { |
| 4427 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4428 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4429 | assigned[idx] = 1; |
| 4430 | } |
| 4431 | } |
| 4432 | /* left pins can be connect to any audio widget */ |
| 4433 | for (i = 0; i < cfg->line_outs; i++) { |
| 4434 | nid = cfg->line_out_pins[i]; |
| 4435 | if (alc880_is_fixed_pin(nid)) |
| 4436 | continue; |
| 4437 | /* search for an empty channel */ |
| 4438 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4439 | if (!assigned[j]) { |
| 4440 | spec->multiout.dac_nids[i] = |
| 4441 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4442 | assigned[j] = 1; |
| 4443 | break; |
| 4444 | } |
| 4445 | } |
| 4446 | } |
| 4447 | spec->multiout.num_dacs = cfg->line_outs; |
| 4448 | return 0; |
| 4449 | } |
| 4450 | |
| 4451 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4452 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4453 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4454 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4455 | static const char *chname[4] = { |
| 4456 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4457 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4458 | hda_nid_t nid; |
| 4459 | int i, err; |
| 4460 | |
| 4461 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4462 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4463 | continue; |
| 4464 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4465 | if (i == 2) { |
| 4466 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4467 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 4468 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4469 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4470 | HDA_OUTPUT)); |
| 4471 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4472 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4473 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 4474 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4475 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4476 | HDA_OUTPUT)); |
| 4477 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4478 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4479 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 4480 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4481 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4482 | HDA_INPUT)); |
| 4483 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4484 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4485 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 4486 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4487 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4488 | HDA_INPUT)); |
| 4489 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4490 | return err; |
| 4491 | } else { |
Takashi Iwai | cb162b6 | 2009-08-25 16:05:03 +0200 | [diff] [blame] | 4492 | const char *pfx; |
| 4493 | if (cfg->line_outs == 1 && |
| 4494 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 4495 | pfx = "Speaker"; |
| 4496 | else |
| 4497 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4498 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4499 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4500 | HDA_OUTPUT)); |
| 4501 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4502 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4503 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4504 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4505 | HDA_INPUT)); |
| 4506 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4507 | return err; |
| 4508 | } |
| 4509 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4510 | return 0; |
| 4511 | } |
| 4512 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4513 | /* add playback controls for speaker and HP outputs */ |
| 4514 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4515 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4516 | { |
| 4517 | hda_nid_t nid; |
| 4518 | int err; |
| 4519 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4520 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4521 | return 0; |
| 4522 | |
| 4523 | if (alc880_is_fixed_pin(pin)) { |
| 4524 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4525 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4526 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4527 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4528 | else |
| 4529 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4530 | /* control HP volume/switch on the output mixer amp */ |
| 4531 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4532 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4533 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4534 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4535 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4536 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4537 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4538 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4539 | return err; |
| 4540 | } else if (alc880_is_multi_pin(pin)) { |
| 4541 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4542 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4543 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4544 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4545 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4546 | return err; |
| 4547 | } |
| 4548 | return 0; |
| 4549 | } |
| 4550 | |
| 4551 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4552 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4553 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4554 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4555 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4556 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4557 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4558 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4559 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4560 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4561 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4562 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4563 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4564 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4565 | return err; |
| 4566 | return 0; |
| 4567 | } |
| 4568 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4569 | 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] | 4570 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4571 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 4572 | return (pincap & AC_PINCAP_IN) != 0; |
| 4573 | } |
| 4574 | |
| 4575 | /* create playback/capture controls for input pins */ |
| 4576 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 4577 | const struct auto_pin_cfg *cfg, |
| 4578 | hda_nid_t mixer, |
| 4579 | hda_nid_t cap1, hda_nid_t cap2) |
| 4580 | { |
| 4581 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4582 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4583 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4584 | |
| 4585 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4586 | hda_nid_t pin; |
| 4587 | |
| 4588 | pin = cfg->input_pins[i]; |
| 4589 | if (!alc_is_input_pin(codec, pin)) |
| 4590 | continue; |
| 4591 | |
| 4592 | if (mixer) { |
| 4593 | idx = get_connection_index(codec, mixer, pin); |
| 4594 | if (idx >= 0) { |
| 4595 | err = new_analog_input(spec, pin, |
| 4596 | auto_pin_cfg_labels[i], |
| 4597 | idx, mixer); |
| 4598 | if (err < 0) |
| 4599 | return err; |
| 4600 | } |
| 4601 | } |
| 4602 | |
| 4603 | if (!cap1) |
| 4604 | continue; |
| 4605 | idx = get_connection_index(codec, cap1, pin); |
| 4606 | if (idx < 0 && cap2) |
| 4607 | idx = get_connection_index(codec, cap2, pin); |
| 4608 | if (idx >= 0) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4609 | imux->items[imux->num_items].label = |
| 4610 | auto_pin_cfg_labels[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4611 | imux->items[imux->num_items].index = idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4612 | imux->num_items++; |
| 4613 | } |
| 4614 | } |
| 4615 | return 0; |
| 4616 | } |
| 4617 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4618 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 4619 | const struct auto_pin_cfg *cfg) |
| 4620 | { |
| 4621 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 4622 | } |
| 4623 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4624 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4625 | unsigned int pin_type) |
| 4626 | { |
| 4627 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4628 | pin_type); |
| 4629 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4630 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4631 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4632 | } |
| 4633 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4634 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4635 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4636 | int dac_idx) |
| 4637 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4638 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4639 | /* need the manual connection? */ |
| 4640 | if (alc880_is_multi_pin(nid)) { |
| 4641 | struct alc_spec *spec = codec->spec; |
| 4642 | int idx = alc880_multi_pin_idx(nid); |
| 4643 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4644 | AC_VERB_SET_CONNECT_SEL, |
| 4645 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4646 | } |
| 4647 | } |
| 4648 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4649 | static int get_pin_type(int line_out_type) |
| 4650 | { |
| 4651 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4652 | return PIN_HP; |
| 4653 | else |
| 4654 | return PIN_OUT; |
| 4655 | } |
| 4656 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4657 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4658 | { |
| 4659 | struct alc_spec *spec = codec->spec; |
| 4660 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4661 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4662 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4663 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4664 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4665 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4666 | } |
| 4667 | } |
| 4668 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4669 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4670 | { |
| 4671 | struct alc_spec *spec = codec->spec; |
| 4672 | hda_nid_t pin; |
| 4673 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4674 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4675 | if (pin) /* connect to front */ |
| 4676 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4677 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4678 | if (pin) /* connect to front */ |
| 4679 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4680 | } |
| 4681 | |
| 4682 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4683 | { |
| 4684 | struct alc_spec *spec = codec->spec; |
| 4685 | int i; |
| 4686 | |
| 4687 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4688 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4689 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 4690 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 4691 | if (nid != ALC880_PIN_CD_NID && |
| 4692 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4693 | snd_hda_codec_write(codec, nid, 0, |
| 4694 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4695 | AMP_OUT_MUTE); |
| 4696 | } |
| 4697 | } |
| 4698 | } |
| 4699 | |
| 4700 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4701 | /* return 1 if successful, 0 if the proper config is not found, |
| 4702 | * or a negative error code |
| 4703 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4704 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4705 | { |
| 4706 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4707 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4708 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4709 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4710 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4711 | alc880_ignore); |
| 4712 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4713 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4714 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4715 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4716 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4717 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4718 | if (err < 0) |
| 4719 | return err; |
| 4720 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4721 | if (err < 0) |
| 4722 | return err; |
| 4723 | err = alc880_auto_create_extra_out(spec, |
| 4724 | spec->autocfg.speaker_pins[0], |
| 4725 | "Speaker"); |
| 4726 | if (err < 0) |
| 4727 | return err; |
| 4728 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4729 | "Headphone"); |
| 4730 | if (err < 0) |
| 4731 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4732 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4733 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4734 | return err; |
| 4735 | |
| 4736 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4737 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4738 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4739 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4740 | hda_nid_t dig_nid; |
| 4741 | err = snd_hda_get_connections(codec, |
| 4742 | spec->autocfg.dig_out_pins[i], |
| 4743 | &dig_nid, 1); |
| 4744 | if (err < 0) |
| 4745 | continue; |
| 4746 | if (!i) |
| 4747 | spec->multiout.dig_out_nid = dig_nid; |
| 4748 | else { |
| 4749 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 4750 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4751 | break; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 4752 | spec->slave_dig_outs[i - 1] = dig_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4753 | } |
| 4754 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4755 | if (spec->autocfg.dig_in_pin) |
| 4756 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4757 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4758 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4759 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4760 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4761 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4762 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4763 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4764 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4765 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 4766 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 4767 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4768 | return 1; |
| 4769 | } |
| 4770 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4771 | /* additional initialization for auto-configuration model */ |
| 4772 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4773 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4774 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4775 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4776 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4777 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4778 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4779 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4780 | } |
| 4781 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4782 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 4783 | * one of two digital mic pins, e.g. on ALC272 |
| 4784 | */ |
| 4785 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4786 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4787 | struct alc_spec *spec = codec->spec; |
| 4788 | int i; |
| 4789 | |
| 4790 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 4791 | hda_nid_t cap = spec->capsrc_nids ? |
| 4792 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 4793 | int iidx, eidx; |
| 4794 | |
| 4795 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 4796 | if (iidx < 0) |
| 4797 | continue; |
| 4798 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 4799 | if (eidx < 0) |
| 4800 | continue; |
| 4801 | spec->int_mic.mux_idx = iidx; |
| 4802 | spec->ext_mic.mux_idx = eidx; |
| 4803 | if (spec->capsrc_nids) |
| 4804 | spec->capsrc_nids += i; |
| 4805 | spec->adc_nids += i; |
| 4806 | spec->num_adc_nids = 1; |
| 4807 | return; |
| 4808 | } |
| 4809 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 4810 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 4811 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 4812 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 4813 | } |
| 4814 | |
| 4815 | static void set_capture_mixer(struct hda_codec *codec) |
| 4816 | { |
| 4817 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4818 | static struct snd_kcontrol_new *caps[2][3] = { |
| 4819 | { alc_capture_mixer_nosrc1, |
| 4820 | alc_capture_mixer_nosrc2, |
| 4821 | alc_capture_mixer_nosrc3 }, |
| 4822 | { alc_capture_mixer1, |
| 4823 | alc_capture_mixer2, |
| 4824 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4825 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4826 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
| 4827 | int mux; |
Takashi Iwai | 2a22d3f | 2009-08-10 18:54:38 +0200 | [diff] [blame] | 4828 | if (spec->auto_mic) { |
| 4829 | mux = 0; |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4830 | fixup_automic_adc(codec); |
Takashi Iwai | 2a22d3f | 2009-08-10 18:54:38 +0200 | [diff] [blame] | 4831 | } else if (spec->input_mux && spec->input_mux->num_items > 1) |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4832 | mux = 1; |
| 4833 | else |
| 4834 | mux = 0; |
| 4835 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; |
| 4836 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4837 | } |
| 4838 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 4839 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4840 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 4841 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 4842 | #else |
| 4843 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
| 4844 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4845 | |
| 4846 | /* |
| 4847 | * OK, here we have finally the patch for ALC880 |
| 4848 | */ |
| 4849 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4850 | static int patch_alc880(struct hda_codec *codec) |
| 4851 | { |
| 4852 | struct alc_spec *spec; |
| 4853 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4854 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4855 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4856 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4857 | if (spec == NULL) |
| 4858 | return -ENOMEM; |
| 4859 | |
| 4860 | codec->spec = spec; |
| 4861 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4862 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 4863 | alc880_models, |
| 4864 | alc880_cfg_tbl); |
| 4865 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 4866 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 4867 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4868 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4869 | } |
| 4870 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4871 | if (board_config == ALC880_AUTO) { |
| 4872 | /* automatic parse from the BIOS config */ |
| 4873 | err = alc880_parse_auto_config(codec); |
| 4874 | if (err < 0) { |
| 4875 | alc_free(codec); |
| 4876 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4877 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4878 | printk(KERN_INFO |
| 4879 | "hda_codec: Cannot set up configuration " |
| 4880 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4881 | board_config = ALC880_3ST; |
| 4882 | } |
| 4883 | } |
| 4884 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4885 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 4886 | if (err < 0) { |
| 4887 | alc_free(codec); |
| 4888 | return err; |
| 4889 | } |
| 4890 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4891 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 4892 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4893 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4894 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 4895 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4896 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4897 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4898 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 4899 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 4900 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4901 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4902 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 4903 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4904 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 4905 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4906 | if (wcap != AC_WID_AUD_IN) { |
| 4907 | spec->adc_nids = alc880_adc_nids_alt; |
| 4908 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4909 | } else { |
| 4910 | spec->adc_nids = alc880_adc_nids; |
| 4911 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4912 | } |
| 4913 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4914 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4915 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4916 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 4917 | spec->vmaster_nid = 0x0c; |
| 4918 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4919 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4920 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4921 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4922 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4923 | if (!spec->loopback.amplist) |
| 4924 | spec->loopback.amplist = alc880_loopbacks; |
| 4925 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 4926 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4927 | |
| 4928 | return 0; |
| 4929 | } |
| 4930 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4931 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4932 | /* |
| 4933 | * ALC260 support |
| 4934 | */ |
| 4935 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4936 | static hda_nid_t alc260_dac_nids[1] = { |
| 4937 | /* front */ |
| 4938 | 0x02, |
| 4939 | }; |
| 4940 | |
| 4941 | static hda_nid_t alc260_adc_nids[1] = { |
| 4942 | /* ADC0 */ |
| 4943 | 0x04, |
| 4944 | }; |
| 4945 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4946 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4947 | /* ADC1 */ |
| 4948 | 0x05, |
| 4949 | }; |
| 4950 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4951 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4952 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4953 | */ |
| 4954 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4955 | /* ADC0, ADC1 */ |
| 4956 | 0x04, 0x05 |
| 4957 | }; |
| 4958 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4959 | #define ALC260_DIGOUT_NID 0x03 |
| 4960 | #define ALC260_DIGIN_NID 0x06 |
| 4961 | |
| 4962 | static struct hda_input_mux alc260_capture_source = { |
| 4963 | .num_items = 4, |
| 4964 | .items = { |
| 4965 | { "Mic", 0x0 }, |
| 4966 | { "Front Mic", 0x1 }, |
| 4967 | { "Line", 0x2 }, |
| 4968 | { "CD", 0x4 }, |
| 4969 | }, |
| 4970 | }; |
| 4971 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4972 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4973 | * headphone jack and the internal CD lines since these are the only pins at |
| 4974 | * which audio can appear. For flexibility, also allow the option of |
| 4975 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4976 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4977 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4978 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4979 | { |
| 4980 | .num_items = 3, |
| 4981 | .items = { |
| 4982 | { "Mic/Line", 0x0 }, |
| 4983 | { "CD", 0x4 }, |
| 4984 | { "Headphone", 0x2 }, |
| 4985 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4986 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4987 | { |
| 4988 | .num_items = 4, |
| 4989 | .items = { |
| 4990 | { "Mic/Line", 0x0 }, |
| 4991 | { "CD", 0x4 }, |
| 4992 | { "Headphone", 0x2 }, |
| 4993 | { "Mixer", 0x5 }, |
| 4994 | }, |
| 4995 | }, |
| 4996 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4997 | }; |
| 4998 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4999 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 5000 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5001 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5002 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 5003 | { |
| 5004 | .num_items = 4, |
| 5005 | .items = { |
| 5006 | { "Mic", 0x0 }, |
| 5007 | { "Line", 0x2 }, |
| 5008 | { "CD", 0x4 }, |
| 5009 | { "Headphone", 0x5 }, |
| 5010 | }, |
| 5011 | }, |
| 5012 | { |
| 5013 | .num_items = 5, |
| 5014 | .items = { |
| 5015 | { "Mic", 0x0 }, |
| 5016 | { "Line", 0x2 }, |
| 5017 | { "CD", 0x4 }, |
| 5018 | { "Headphone", 0x6 }, |
| 5019 | { "Mixer", 0x5 }, |
| 5020 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5021 | }, |
| 5022 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5023 | |
| 5024 | /* Maxdata Favorit 100XS */ |
| 5025 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 5026 | { |
| 5027 | .num_items = 2, |
| 5028 | .items = { |
| 5029 | { "Line/Mic", 0x0 }, |
| 5030 | { "CD", 0x4 }, |
| 5031 | }, |
| 5032 | }, |
| 5033 | { |
| 5034 | .num_items = 3, |
| 5035 | .items = { |
| 5036 | { "Line/Mic", 0x0 }, |
| 5037 | { "CD", 0x4 }, |
| 5038 | { "Mixer", 0x5 }, |
| 5039 | }, |
| 5040 | }, |
| 5041 | }; |
| 5042 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5043 | /* |
| 5044 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 5045 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 5046 | * element which allows changing the channel mode, so the verb list is |
| 5047 | * never used. |
| 5048 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5049 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5050 | { 2, NULL }, |
| 5051 | }; |
| 5052 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5053 | |
| 5054 | /* Mixer combinations |
| 5055 | * |
| 5056 | * basic: base_output + input + pc_beep + capture |
| 5057 | * HP: base_output + input + capture_alt |
| 5058 | * HP_3013: hp_3013 + input + capture |
| 5059 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5060 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5061 | */ |
| 5062 | |
| 5063 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5064 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5065 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5066 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5067 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5068 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5069 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5070 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5071 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5072 | |
| 5073 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5074 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5075 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5076 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5077 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5078 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5079 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5080 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5081 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5082 | { } /* end */ |
| 5083 | }; |
| 5084 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5085 | /* update HP, line and mono out pins according to the master switch */ |
| 5086 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 5087 | hda_nid_t hp, hda_nid_t line, |
| 5088 | hda_nid_t mono) |
| 5089 | { |
| 5090 | struct alc_spec *spec = codec->spec; |
| 5091 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 5092 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5093 | 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] | 5094 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5095 | 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] | 5096 | val); |
| 5097 | /* mono (speaker) depending on the HP jack sense */ |
| 5098 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5099 | 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] | 5100 | val); |
| 5101 | } |
| 5102 | |
| 5103 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 5104 | struct snd_ctl_elem_value *ucontrol) |
| 5105 | { |
| 5106 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5107 | struct alc_spec *spec = codec->spec; |
| 5108 | *ucontrol->value.integer.value = spec->master_sw; |
| 5109 | return 0; |
| 5110 | } |
| 5111 | |
| 5112 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 5113 | struct snd_ctl_elem_value *ucontrol) |
| 5114 | { |
| 5115 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5116 | struct alc_spec *spec = codec->spec; |
| 5117 | int val = !!*ucontrol->value.integer.value; |
| 5118 | hda_nid_t hp, line, mono; |
| 5119 | |
| 5120 | if (val == spec->master_sw) |
| 5121 | return 0; |
| 5122 | spec->master_sw = val; |
| 5123 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 5124 | line = (kcontrol->private_value >> 8) & 0xff; |
| 5125 | mono = kcontrol->private_value & 0xff; |
| 5126 | alc260_hp_master_update(codec, hp, line, mono); |
| 5127 | return 1; |
| 5128 | } |
| 5129 | |
| 5130 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 5131 | { |
| 5132 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5133 | .name = "Master Playback Switch", |
| 5134 | .info = snd_ctl_boolean_mono_info, |
| 5135 | .get = alc260_hp_master_sw_get, |
| 5136 | .put = alc260_hp_master_sw_put, |
| 5137 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 5138 | }, |
| 5139 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5140 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 5141 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5142 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5143 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 5144 | HDA_OUTPUT), |
| 5145 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5146 | { } /* end */ |
| 5147 | }; |
| 5148 | |
| 5149 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 5150 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5151 | {}, |
| 5152 | }; |
| 5153 | |
| 5154 | static void alc260_hp_automute(struct hda_codec *codec) |
| 5155 | { |
| 5156 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5157 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5158 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5159 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 5160 | } |
| 5161 | |
| 5162 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5163 | { |
| 5164 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5165 | alc260_hp_automute(codec); |
| 5166 | } |
| 5167 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5168 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5169 | { |
| 5170 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5171 | .name = "Master Playback Switch", |
| 5172 | .info = snd_ctl_boolean_mono_info, |
| 5173 | .get = alc260_hp_master_sw_get, |
| 5174 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5175 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5176 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5177 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5178 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5179 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5180 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5181 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5182 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 5183 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5184 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5185 | { } /* end */ |
| 5186 | }; |
| 5187 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5188 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 5189 | .ops = &snd_hda_bind_vol, |
| 5190 | .values = { |
| 5191 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 5192 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 5193 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 5194 | 0 |
| 5195 | }, |
| 5196 | }; |
| 5197 | |
| 5198 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 5199 | .ops = &snd_hda_bind_sw, |
| 5200 | .values = { |
| 5201 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 5202 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 5203 | 0 |
| 5204 | }, |
| 5205 | }; |
| 5206 | |
| 5207 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 5208 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 5209 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 5210 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 5211 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5212 | { } /* end */ |
| 5213 | }; |
| 5214 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5215 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 5216 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5217 | {}, |
| 5218 | }; |
| 5219 | |
| 5220 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 5221 | { |
| 5222 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5223 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5224 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5225 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5226 | } |
| 5227 | |
| 5228 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 5229 | unsigned int res) |
| 5230 | { |
| 5231 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5232 | alc260_hp_3013_automute(codec); |
| 5233 | } |
| 5234 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5235 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 5236 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5237 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5238 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5239 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5240 | bits); |
| 5241 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5242 | bits); |
| 5243 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5244 | bits); |
| 5245 | } |
| 5246 | |
| 5247 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 5248 | unsigned int res) |
| 5249 | { |
| 5250 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5251 | alc260_hp_3012_automute(codec); |
| 5252 | } |
| 5253 | |
| 5254 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5255 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 5256 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5257 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5258 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5259 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5260 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5261 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5262 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5263 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5264 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5265 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5266 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5267 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5268 | { } /* end */ |
| 5269 | }; |
| 5270 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5271 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 5272 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 5273 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 5274 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 5275 | * whether this behaviour is intentional or is a hardware bug in chip |
| 5276 | * revisions available in early 2006. Therefore for now allow the |
| 5277 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 5278 | * that the lack of mic bias for this NID is intentional we could change the |
| 5279 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5280 | * |
| 5281 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 5282 | * don't appear to make the mic bias available from the "line" jack, even |
| 5283 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 5284 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 5285 | * and the output jack. If this turns out to be the case for all such |
| 5286 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 5287 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5288 | * |
| 5289 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 5290 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 5291 | * controls for such models. On models without a "mono speaker" the control |
| 5292 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5293 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5294 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 5295 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5296 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5297 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5298 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5299 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5300 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5301 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5302 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5303 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5304 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5305 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5306 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5307 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5308 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5309 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5310 | { } /* end */ |
| 5311 | }; |
| 5312 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5313 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 5314 | */ |
| 5315 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 5316 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5317 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 5318 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5319 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5320 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5321 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5322 | { } /* end */ |
| 5323 | }; |
| 5324 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5325 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 5326 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 5327 | */ |
| 5328 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 5329 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5330 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5331 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5332 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5333 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5334 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5335 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5336 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5337 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5338 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5339 | { } /* end */ |
| 5340 | }; |
| 5341 | |
| 5342 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 5343 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 5344 | */ |
| 5345 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 5346 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5347 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5348 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5349 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5350 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5351 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 5352 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 5353 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5354 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5355 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5356 | { } /* end */ |
| 5357 | }; |
| 5358 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5359 | /* |
| 5360 | * initialization verbs |
| 5361 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5362 | static struct hda_verb alc260_init_verbs[] = { |
| 5363 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5364 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5365 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5366 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5367 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5368 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5369 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5370 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5371 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5372 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5373 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 5374 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5375 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5376 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5377 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5378 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5379 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5380 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5381 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5382 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5383 | /* set connection select to line in (default select for this ADC) */ |
| 5384 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5385 | /* mute capture amp left and right */ |
| 5386 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5387 | /* set connection select to line in (default select for this ADC) */ |
| 5388 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5389 | /* set vol=0 Line-Out mixer amp left and right */ |
| 5390 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5391 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5392 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5393 | /* set vol=0 HP mixer amp left and right */ |
| 5394 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5395 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5396 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5397 | /* set vol=0 Mono mixer amp left and right */ |
| 5398 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5399 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5400 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5401 | /* unmute LINE-2 out pin */ |
| 5402 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5403 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5404 | * Line In 2 = 0x03 |
| 5405 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5406 | /* mute analog inputs */ |
| 5407 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5408 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5409 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5410 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5411 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5412 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5413 | /* mute Front out path */ |
| 5414 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5415 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5416 | /* mute Headphone out path */ |
| 5417 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5418 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5419 | /* mute Mono out path */ |
| 5420 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5421 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5422 | { } |
| 5423 | }; |
| 5424 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5425 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5426 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 5427 | /* Headphone and output */ |
| 5428 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5429 | /* mono output */ |
| 5430 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5431 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5432 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5433 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5434 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5435 | /* Line In pin widget for input */ |
| 5436 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5437 | /* Line-2 pin widget for output */ |
| 5438 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5439 | /* CD pin widget for input */ |
| 5440 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5441 | /* unmute amp left and right */ |
| 5442 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5443 | /* set connection select to line in (default select for this ADC) */ |
| 5444 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5445 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5446 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5447 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5448 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5449 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5450 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5451 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5452 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5453 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5454 | * Line In 2 = 0x03 |
| 5455 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5456 | /* mute analog inputs */ |
| 5457 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5458 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5459 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5460 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5461 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5462 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5463 | /* Unmute Front out path */ |
| 5464 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5465 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5466 | /* Unmute Headphone out path */ |
| 5467 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5468 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5469 | /* Unmute Mono out path */ |
| 5470 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5471 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5472 | { } |
| 5473 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5474 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5475 | |
| 5476 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5477 | /* Line out and output */ |
| 5478 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5479 | /* mono output */ |
| 5480 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5481 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5482 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5483 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5484 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5485 | /* Line In pin widget for input */ |
| 5486 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5487 | /* Headphone pin widget for output */ |
| 5488 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5489 | /* CD pin widget for input */ |
| 5490 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5491 | /* unmute amp left and right */ |
| 5492 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5493 | /* set connection select to line in (default select for this ADC) */ |
| 5494 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5495 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5496 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5497 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5498 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5499 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5500 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5501 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5502 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5503 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5504 | * Line In 2 = 0x03 |
| 5505 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5506 | /* mute analog inputs */ |
| 5507 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5508 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5509 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5510 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5511 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5512 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5513 | /* Unmute Front out path */ |
| 5514 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5515 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5516 | /* Unmute Headphone out path */ |
| 5517 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5518 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5519 | /* Unmute Mono out path */ |
| 5520 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5521 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5522 | { } |
| 5523 | }; |
| 5524 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5525 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5526 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5527 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5528 | */ |
| 5529 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5530 | /* Disable all GPIOs */ |
| 5531 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5532 | /* Internal speaker is connected to headphone pin */ |
| 5533 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5534 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5535 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5536 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5537 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5538 | /* Ensure all other unused pins are disabled and muted. */ |
| 5539 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5540 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5541 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5542 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5543 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5544 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5545 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5546 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5547 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5548 | /* Disable digital (SPDIF) pins */ |
| 5549 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5550 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5551 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5552 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5553 | * when acting as an output. |
| 5554 | */ |
| 5555 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5556 | |
| 5557 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5558 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5559 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5560 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5561 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5562 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5563 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5564 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5565 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5566 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5567 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5568 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5569 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5570 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5571 | * If the pin mode is changed by the user the pin mode control will |
| 5572 | * take care of enabling the pin's input/output buffers as needed. |
| 5573 | * Therefore there's no need to enable the input buffer at this |
| 5574 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5575 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5576 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5577 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5578 | * mixer ctrl) |
| 5579 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5580 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5581 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5582 | /* Mute capture amp left and right */ |
| 5583 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5584 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5585 | * in (on mic1 pin) |
| 5586 | */ |
| 5587 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5588 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5589 | /* Do the same for the second ADC: mute capture input amp and |
| 5590 | * set ADC connection to line in (on mic1 pin) |
| 5591 | */ |
| 5592 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5593 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5594 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5595 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5596 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5597 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5598 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5599 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5600 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5601 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5602 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5603 | {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] | 5604 | |
| 5605 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5606 | }; |
| 5607 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5608 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5609 | * similar laptops (adapted from Fujitsu init verbs). |
| 5610 | */ |
| 5611 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5612 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5613 | * the headphone jack. Turn this on and rely on the standard mute |
| 5614 | * methods whenever the user wants to turn these outputs off. |
| 5615 | */ |
| 5616 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5617 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5618 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5619 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5620 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5621 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5622 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5623 | /* Line In jack is connected to Line1 pin */ |
| 5624 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5625 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5626 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5627 | /* Ensure all other unused pins are disabled and muted. */ |
| 5628 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5629 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5630 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5631 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5632 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5633 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5634 | /* Disable digital (SPDIF) pins */ |
| 5635 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5636 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5637 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5638 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5639 | * bus when acting as outputs. |
| 5640 | */ |
| 5641 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5642 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5643 | |
| 5644 | /* Start with output sum widgets muted and their output gains at min */ |
| 5645 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5646 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5647 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5648 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5649 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5650 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5651 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5652 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5653 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5654 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5655 | /* Unmute Line-out pin widget amp left and right |
| 5656 | * (no equiv mixer ctrl) |
| 5657 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5658 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5659 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5660 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5661 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5662 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5663 | * will take care of enabling the pin's input/output buffers as needed. |
| 5664 | * Therefore there's no need to enable the input buffer at this |
| 5665 | * stage. |
| 5666 | */ |
| 5667 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5668 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5669 | |
| 5670 | /* Mute capture amp left and right */ |
| 5671 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5672 | /* Set ADC connection select to match default mixer setting - mic |
| 5673 | * (on mic1 pin) |
| 5674 | */ |
| 5675 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5676 | |
| 5677 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5678 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5679 | */ |
| 5680 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5681 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5682 | |
| 5683 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5684 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5685 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5686 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5687 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5688 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5689 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5690 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5691 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5692 | |
| 5693 | { } |
| 5694 | }; |
| 5695 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5696 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 5697 | * (adapted from Acer init verbs). |
| 5698 | */ |
| 5699 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 5700 | /* GPIO 0 enables the output jack. |
| 5701 | * Turn this on and rely on the standard mute |
| 5702 | * methods whenever the user wants to turn these outputs off. |
| 5703 | */ |
| 5704 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5705 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5706 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5707 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 5708 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5709 | /* Ensure all other unused pins are disabled and muted. */ |
| 5710 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5711 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5712 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5713 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5714 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5715 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5716 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5717 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5718 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5719 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5720 | /* Disable digital (SPDIF) pins */ |
| 5721 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5722 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5723 | |
| 5724 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 5725 | * bus when acting as outputs. |
| 5726 | */ |
| 5727 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5728 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5729 | |
| 5730 | /* Start with output sum widgets muted and their output gains at min */ |
| 5731 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5732 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5733 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5734 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5735 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5736 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5737 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5738 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5739 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5740 | |
| 5741 | /* Unmute Line-out pin widget amp left and right |
| 5742 | * (no equiv mixer ctrl) |
| 5743 | */ |
| 5744 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5745 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5746 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5747 | * will take care of enabling the pin's input/output buffers as needed. |
| 5748 | * Therefore there's no need to enable the input buffer at this |
| 5749 | * stage. |
| 5750 | */ |
| 5751 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5752 | |
| 5753 | /* Mute capture amp left and right */ |
| 5754 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5755 | /* Set ADC connection select to match default mixer setting - mic |
| 5756 | * (on mic1 pin) |
| 5757 | */ |
| 5758 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5759 | |
| 5760 | /* Do similar with the second ADC: mute capture input amp and |
| 5761 | * set ADC connection to mic to match ALSA's default state. |
| 5762 | */ |
| 5763 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5764 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5765 | |
| 5766 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5767 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5768 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5769 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5770 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5771 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5772 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5773 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5774 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5775 | |
| 5776 | { } |
| 5777 | }; |
| 5778 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5779 | static struct hda_verb alc260_will_verbs[] = { |
| 5780 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5781 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5782 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5783 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5784 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5785 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 5786 | {} |
| 5787 | }; |
| 5788 | |
| 5789 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 5790 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5791 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5792 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 5793 | |
| 5794 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5795 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5796 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5797 | |
| 5798 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5799 | {} |
| 5800 | }; |
| 5801 | |
| 5802 | /* toggle speaker-output according to the hp-jack state */ |
| 5803 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 5804 | { |
| 5805 | unsigned int present; |
| 5806 | |
| 5807 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5808 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5809 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5810 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5811 | AC_VERB_SET_GPIO_DATA, 1); |
| 5812 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5813 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5814 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5815 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5816 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5817 | AC_VERB_SET_GPIO_DATA, 0); |
| 5818 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5819 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5820 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5821 | } |
| 5822 | } |
| 5823 | |
| 5824 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 5825 | unsigned int res) |
| 5826 | { |
| 5827 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5828 | alc260_replacer_672v_automute(codec); |
| 5829 | } |
| 5830 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5831 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 5832 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5833 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5834 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5835 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5836 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5837 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5838 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5839 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5840 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5841 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5842 | {} |
| 5843 | }; |
| 5844 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5845 | /* Test configuration for debugging, modelled after the ALC880 test |
| 5846 | * configuration. |
| 5847 | */ |
| 5848 | #ifdef CONFIG_SND_DEBUG |
| 5849 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 5850 | 0x02, |
| 5851 | }; |
| 5852 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 5853 | 0x04, 0x05, |
| 5854 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5855 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5856 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5857 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5858 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5859 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 5860 | { |
| 5861 | .num_items = 7, |
| 5862 | .items = { |
| 5863 | { "MIC1 pin", 0x0 }, |
| 5864 | { "MIC2 pin", 0x1 }, |
| 5865 | { "LINE1 pin", 0x2 }, |
| 5866 | { "LINE2 pin", 0x3 }, |
| 5867 | { "CD pin", 0x4 }, |
| 5868 | { "LINE-OUT pin", 0x5 }, |
| 5869 | { "HP-OUT pin", 0x6 }, |
| 5870 | }, |
| 5871 | }, |
| 5872 | { |
| 5873 | .num_items = 8, |
| 5874 | .items = { |
| 5875 | { "MIC1 pin", 0x0 }, |
| 5876 | { "MIC2 pin", 0x1 }, |
| 5877 | { "LINE1 pin", 0x2 }, |
| 5878 | { "LINE2 pin", 0x3 }, |
| 5879 | { "CD pin", 0x4 }, |
| 5880 | { "Mixer", 0x5 }, |
| 5881 | { "LINE-OUT pin", 0x6 }, |
| 5882 | { "HP-OUT pin", 0x7 }, |
| 5883 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5884 | }, |
| 5885 | }; |
| 5886 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 5887 | /* Output driver widgets */ |
| 5888 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5889 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5890 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5891 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 5892 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5893 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 5894 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5895 | /* Modes for retasking pin widgets |
| 5896 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 5897 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 5898 | * mention this restriction. At this stage it's not clear whether |
| 5899 | * this behaviour is intentional or is a hardware bug in chip |
| 5900 | * revisions available at least up until early 2006. Therefore for |
| 5901 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 5902 | * choices, but if it turns out that the lack of mic bias for these |
| 5903 | * NIDs is intentional we could change their modes from |
| 5904 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5905 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5906 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 5907 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5908 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 5909 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5910 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 5911 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 5912 | |
| 5913 | /* Loopback mixer controls */ |
| 5914 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 5915 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 5916 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5917 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 5918 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5919 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5920 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 5921 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 5922 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5923 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5924 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5925 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5926 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 5927 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5928 | |
| 5929 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 5930 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 5931 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 5932 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 5933 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 5934 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5935 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 5936 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5937 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5938 | */ |
| 5939 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 5940 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 5941 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 5942 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 5943 | * this output to turn on an external amplifier. |
| 5944 | */ |
| 5945 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 5946 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 5947 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5948 | { } /* end */ |
| 5949 | }; |
| 5950 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5951 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 5952 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 5953 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5954 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 5955 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5956 | /* Enable retasking pins as output, initially without power amp */ |
| 5957 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5958 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5959 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5960 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5961 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5962 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5963 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5964 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 5965 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 5966 | * payload also sets the generation to 0, output to be in "consumer" |
| 5967 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 5968 | * control. |
| 5969 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5970 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5971 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5972 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5973 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5974 | * OUT1 sum bus when acting as an output. |
| 5975 | */ |
| 5976 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5977 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5978 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5979 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5980 | |
| 5981 | /* Start with output sum widgets muted and their output gains at min */ |
| 5982 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5983 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5984 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5985 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5986 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5987 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5988 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5989 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5990 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5991 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5992 | /* Unmute retasking pin widget output buffers since the default |
| 5993 | * state appears to be output. As the pin mode is changed by the |
| 5994 | * user the pin mode control will take care of enabling the pin's |
| 5995 | * input/output buffers as needed. |
| 5996 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5997 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5998 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5999 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6000 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6001 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6002 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6003 | /* Also unmute the mono-out pin widget */ |
| 6004 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6005 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6006 | /* Mute capture amp left and right */ |
| 6007 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6008 | /* Set ADC connection select to match default mixer setting (mic1 |
| 6009 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6010 | */ |
| 6011 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6012 | |
| 6013 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6014 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6015 | */ |
| 6016 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6017 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6018 | |
| 6019 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6020 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6021 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6022 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6023 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6024 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6025 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6026 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6027 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6028 | |
| 6029 | { } |
| 6030 | }; |
| 6031 | #endif |
| 6032 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6033 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 6034 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6035 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6036 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 6037 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 6038 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6039 | /* |
| 6040 | * for BIOS auto-configuration |
| 6041 | */ |
| 6042 | |
| 6043 | 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] | 6044 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6045 | { |
| 6046 | hda_nid_t nid_vol; |
| 6047 | unsigned long vol_val, sw_val; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6048 | int err; |
| 6049 | |
| 6050 | if (nid >= 0x0f && nid < 0x11) { |
| 6051 | nid_vol = nid - 0x7; |
| 6052 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6053 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6054 | } else if (nid == 0x11) { |
| 6055 | nid_vol = nid - 0x7; |
| 6056 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 6057 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 6058 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 6059 | nid_vol = 0x08; |
| 6060 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6061 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6062 | } else |
| 6063 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6064 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6065 | if (!(*vol_bits & (1 << nid_vol))) { |
| 6066 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6067 | 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] | 6068 | if (err < 0) |
| 6069 | return err; |
| 6070 | *vol_bits |= (1 << nid_vol); |
| 6071 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6072 | 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] | 6073 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6074 | return err; |
| 6075 | return 1; |
| 6076 | } |
| 6077 | |
| 6078 | /* add playback controls from the parsed DAC table */ |
| 6079 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 6080 | const struct auto_pin_cfg *cfg) |
| 6081 | { |
| 6082 | hda_nid_t nid; |
| 6083 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6084 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6085 | |
| 6086 | spec->multiout.num_dacs = 1; |
| 6087 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6088 | spec->multiout.dac_nids[0] = 0x02; |
| 6089 | |
| 6090 | nid = cfg->line_out_pins[0]; |
| 6091 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 6092 | const char *pfx; |
| 6093 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 6094 | pfx = "Master"; |
| 6095 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 6096 | pfx = "Speaker"; |
| 6097 | else |
| 6098 | pfx = "Front"; |
| 6099 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6100 | if (err < 0) |
| 6101 | return err; |
| 6102 | } |
| 6103 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6104 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6105 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6106 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6107 | if (err < 0) |
| 6108 | return err; |
| 6109 | } |
| 6110 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6111 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6112 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6113 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 6114 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6115 | if (err < 0) |
| 6116 | return err; |
| 6117 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6118 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6119 | } |
| 6120 | |
| 6121 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6122 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6123 | const struct auto_pin_cfg *cfg) |
| 6124 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6125 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6126 | } |
| 6127 | |
| 6128 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6129 | hda_nid_t nid, int pin_type, |
| 6130 | int sel_idx) |
| 6131 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6132 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6133 | /* need the manual connection? */ |
| 6134 | if (nid >= 0x12) { |
| 6135 | int idx = nid - 0x12; |
| 6136 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 6137 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6138 | } |
| 6139 | } |
| 6140 | |
| 6141 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 6142 | { |
| 6143 | struct alc_spec *spec = codec->spec; |
| 6144 | hda_nid_t nid; |
| 6145 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6146 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6147 | if (nid) { |
| 6148 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 6149 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 6150 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6151 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6152 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6153 | if (nid) |
| 6154 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 6155 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6156 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6157 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6158 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6159 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6160 | |
| 6161 | #define ALC260_PIN_CD_NID 0x16 |
| 6162 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 6163 | { |
| 6164 | struct alc_spec *spec = codec->spec; |
| 6165 | int i; |
| 6166 | |
| 6167 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6168 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 6169 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 6170 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 6171 | if (nid != ALC260_PIN_CD_NID && |
| 6172 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6173 | snd_hda_codec_write(codec, nid, 0, |
| 6174 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6175 | AMP_OUT_MUTE); |
| 6176 | } |
| 6177 | } |
| 6178 | } |
| 6179 | |
| 6180 | /* |
| 6181 | * generic initialization of ADC, input mixers and output mixers |
| 6182 | */ |
| 6183 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 6184 | /* |
| 6185 | * Unmute ADC0-1 and set the default input to mic-in |
| 6186 | */ |
| 6187 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6188 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6189 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6190 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6191 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6192 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6193 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6194 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6195 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6196 | */ |
| 6197 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6198 | /* mute analog inputs */ |
| 6199 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6200 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6201 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6202 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6203 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6204 | |
| 6205 | /* |
| 6206 | * Set up output mixers (0x08 - 0x0a) |
| 6207 | */ |
| 6208 | /* set vol=0 to output mixers */ |
| 6209 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6210 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6211 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6212 | /* set up input amps for analog loopback */ |
| 6213 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6214 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6215 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6216 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6217 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6218 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6219 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6220 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6221 | { } |
| 6222 | }; |
| 6223 | |
| 6224 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 6225 | { |
| 6226 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6227 | int err; |
| 6228 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 6229 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6230 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 6231 | alc260_ignore); |
| 6232 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6233 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6234 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 6235 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6236 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6237 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6238 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6239 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6240 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6241 | return err; |
| 6242 | |
| 6243 | spec->multiout.max_channels = 2; |
| 6244 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 6245 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6246 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6247 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6248 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6249 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6250 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6251 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6252 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 6253 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6254 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 6255 | alc_ssid_check(codec, 0x10, 0x15, 0x0f); |
| 6256 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6257 | return 1; |
| 6258 | } |
| 6259 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6260 | /* additional initialization for auto-configuration model */ |
| 6261 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6262 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6263 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6264 | alc260_auto_init_multi_out(codec); |
| 6265 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6266 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6267 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6268 | } |
| 6269 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6270 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6271 | static struct hda_amp_list alc260_loopbacks[] = { |
| 6272 | { 0x07, HDA_INPUT, 0 }, |
| 6273 | { 0x07, HDA_INPUT, 1 }, |
| 6274 | { 0x07, HDA_INPUT, 2 }, |
| 6275 | { 0x07, HDA_INPUT, 3 }, |
| 6276 | { 0x07, HDA_INPUT, 4 }, |
| 6277 | { } /* end */ |
| 6278 | }; |
| 6279 | #endif |
| 6280 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6281 | /* |
| 6282 | * ALC260 configurations |
| 6283 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6284 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 6285 | [ALC260_BASIC] = "basic", |
| 6286 | [ALC260_HP] = "hp", |
| 6287 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 6288 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6289 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 6290 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6291 | [ALC260_WILL] = "will", |
| 6292 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6293 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6294 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6295 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6296 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6297 | [ALC260_AUTO] = "auto", |
| 6298 | }; |
| 6299 | |
| 6300 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6301 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 6302 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6303 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6304 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 6305 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 6306 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6307 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 6308 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6309 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6310 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 6311 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 6312 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 6313 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 6314 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 6315 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 6316 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 6317 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 6318 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6319 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6320 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6321 | {} |
| 6322 | }; |
| 6323 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6324 | static struct alc_config_preset alc260_presets[] = { |
| 6325 | [ALC260_BASIC] = { |
| 6326 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6327 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6328 | .init_verbs = { alc260_init_verbs }, |
| 6329 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6330 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6331 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6332 | .adc_nids = alc260_adc_nids, |
| 6333 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6334 | .channel_mode = alc260_modes, |
| 6335 | .input_mux = &alc260_capture_source, |
| 6336 | }, |
| 6337 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6338 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6339 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6340 | .init_verbs = { alc260_init_verbs, |
| 6341 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6342 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6343 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6344 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6345 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6346 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6347 | .channel_mode = alc260_modes, |
| 6348 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6349 | .unsol_event = alc260_hp_unsol_event, |
| 6350 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6351 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6352 | [ALC260_HP_DC7600] = { |
| 6353 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6354 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6355 | .init_verbs = { alc260_init_verbs, |
| 6356 | alc260_hp_dc7600_verbs }, |
| 6357 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6358 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6359 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6360 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6361 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6362 | .channel_mode = alc260_modes, |
| 6363 | .input_mux = &alc260_capture_source, |
| 6364 | .unsol_event = alc260_hp_3012_unsol_event, |
| 6365 | .init_hook = alc260_hp_3012_automute, |
| 6366 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6367 | [ALC260_HP_3013] = { |
| 6368 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6369 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6370 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 6371 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6372 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6373 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6374 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6375 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6376 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6377 | .channel_mode = alc260_modes, |
| 6378 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6379 | .unsol_event = alc260_hp_3013_unsol_event, |
| 6380 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6381 | }, |
| 6382 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6383 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6384 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 6385 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6386 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6387 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6388 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6389 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6390 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6391 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 6392 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6393 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6394 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6395 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6396 | .init_verbs = { alc260_acer_init_verbs }, |
| 6397 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6398 | .dac_nids = alc260_dac_nids, |
| 6399 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6400 | .adc_nids = alc260_dual_adc_nids, |
| 6401 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6402 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6403 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 6404 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6405 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6406 | [ALC260_FAVORIT100] = { |
| 6407 | .mixers = { alc260_favorit100_mixer }, |
| 6408 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 6409 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6410 | .dac_nids = alc260_dac_nids, |
| 6411 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6412 | .adc_nids = alc260_dual_adc_nids, |
| 6413 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6414 | .channel_mode = alc260_modes, |
| 6415 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 6416 | .input_mux = alc260_favorit100_capture_sources, |
| 6417 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6418 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6419 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6420 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6421 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6422 | .dac_nids = alc260_dac_nids, |
| 6423 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6424 | .adc_nids = alc260_adc_nids, |
| 6425 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6426 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6427 | .channel_mode = alc260_modes, |
| 6428 | .input_mux = &alc260_capture_source, |
| 6429 | }, |
| 6430 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6431 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6432 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6433 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6434 | .dac_nids = alc260_dac_nids, |
| 6435 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6436 | .adc_nids = alc260_adc_nids, |
| 6437 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6438 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6439 | .channel_mode = alc260_modes, |
| 6440 | .input_mux = &alc260_capture_source, |
| 6441 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6442 | .init_hook = alc260_replacer_672v_automute, |
| 6443 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6444 | #ifdef CONFIG_SND_DEBUG |
| 6445 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6446 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6447 | .init_verbs = { alc260_test_init_verbs }, |
| 6448 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6449 | .dac_nids = alc260_test_dac_nids, |
| 6450 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6451 | .adc_nids = alc260_test_adc_nids, |
| 6452 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6453 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6454 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6455 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6456 | }, |
| 6457 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6458 | }; |
| 6459 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6460 | static int patch_alc260(struct hda_codec *codec) |
| 6461 | { |
| 6462 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6463 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6464 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6465 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6466 | if (spec == NULL) |
| 6467 | return -ENOMEM; |
| 6468 | |
| 6469 | codec->spec = spec; |
| 6470 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6471 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 6472 | alc260_models, |
| 6473 | alc260_cfg_tbl); |
| 6474 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 6475 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 6476 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6477 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6478 | } |
| 6479 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6480 | if (board_config == ALC260_AUTO) { |
| 6481 | /* automatic parse from the BIOS config */ |
| 6482 | err = alc260_parse_auto_config(codec); |
| 6483 | if (err < 0) { |
| 6484 | alc_free(codec); |
| 6485 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6486 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6487 | printk(KERN_INFO |
| 6488 | "hda_codec: Cannot set up configuration " |
| 6489 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6490 | board_config = ALC260_BASIC; |
| 6491 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6492 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6493 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6494 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6495 | if (err < 0) { |
| 6496 | alc_free(codec); |
| 6497 | return err; |
| 6498 | } |
| 6499 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6500 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 6501 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6502 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6503 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6504 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6505 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6506 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6507 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6508 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6509 | if (!spec->adc_nids && spec->input_mux) { |
| 6510 | /* check whether NID 0x04 is valid */ |
| 6511 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 6512 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6513 | /* get type */ |
| 6514 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6515 | spec->adc_nids = alc260_adc_nids_alt; |
| 6516 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6517 | } else { |
| 6518 | spec->adc_nids = alc260_adc_nids; |
| 6519 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6520 | } |
| 6521 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 6522 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6523 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6524 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6525 | spec->vmaster_nid = 0x08; |
| 6526 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6527 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6528 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6529 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6530 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6531 | if (!spec->loopback.amplist) |
| 6532 | spec->loopback.amplist = alc260_loopbacks; |
| 6533 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 6534 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6535 | |
| 6536 | return 0; |
| 6537 | } |
| 6538 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6539 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6540 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6541 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6542 | * |
| 6543 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6544 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6545 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6546 | * 6-channel independent captures. |
| 6547 | * |
| 6548 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6549 | * driver yet). |
| 6550 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6551 | #define ALC882_DIGOUT_NID 0x06 |
| 6552 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6553 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 6554 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 6555 | #define ALC1200_DIGOUT_NID 0x10 |
| 6556 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6557 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6558 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6559 | { 8, NULL } |
| 6560 | }; |
| 6561 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6562 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6563 | static hda_nid_t alc882_dac_nids[4] = { |
| 6564 | /* front, rear, clfe, rear_surr */ |
| 6565 | 0x02, 0x03, 0x04, 0x05 |
| 6566 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6567 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6568 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6569 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6570 | #define alc882_adc_nids alc880_adc_nids |
| 6571 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6572 | #define alc883_adc_nids alc882_adc_nids_alt |
| 6573 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 6574 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 6575 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6576 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6577 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 6578 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6579 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 6580 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 6581 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6582 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6583 | /* input MUX */ |
| 6584 | /* FIXME: should be a matrix-type input source selection */ |
| 6585 | |
| 6586 | static struct hda_input_mux alc882_capture_source = { |
| 6587 | .num_items = 4, |
| 6588 | .items = { |
| 6589 | { "Mic", 0x0 }, |
| 6590 | { "Front Mic", 0x1 }, |
| 6591 | { "Line", 0x2 }, |
| 6592 | { "CD", 0x4 }, |
| 6593 | }, |
| 6594 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6595 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6596 | #define alc883_capture_source alc882_capture_source |
| 6597 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6598 | static struct hda_input_mux alc889_capture_source = { |
| 6599 | .num_items = 3, |
| 6600 | .items = { |
| 6601 | { "Front Mic", 0x0 }, |
| 6602 | { "Mic", 0x3 }, |
| 6603 | { "Line", 0x2 }, |
| 6604 | }, |
| 6605 | }; |
| 6606 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6607 | static struct hda_input_mux mb5_capture_source = { |
| 6608 | .num_items = 3, |
| 6609 | .items = { |
| 6610 | { "Mic", 0x1 }, |
| 6611 | { "Line", 0x2 }, |
| 6612 | { "CD", 0x4 }, |
| 6613 | }, |
| 6614 | }; |
| 6615 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6616 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 6617 | .num_items = 4, |
| 6618 | .items = { |
| 6619 | { "Mic", 0x1 }, |
| 6620 | { "Front Mic", 0x0 }, |
| 6621 | { "Line", 0x2 }, |
| 6622 | { "CD", 0x4 }, |
| 6623 | }, |
| 6624 | }; |
| 6625 | |
| 6626 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6627 | .num_items = 2, |
| 6628 | .items = { |
| 6629 | { "Mic", 0x1 }, |
| 6630 | { "Line", 0x2 }, |
| 6631 | }, |
| 6632 | }; |
| 6633 | |
| 6634 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6635 | .num_items = 4, |
| 6636 | .items = { |
| 6637 | { "Mic", 0x0 }, |
| 6638 | { "iMic", 0x1 }, |
| 6639 | { "Line", 0x2 }, |
| 6640 | { "CD", 0x4 }, |
| 6641 | }, |
| 6642 | }; |
| 6643 | |
| 6644 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6645 | .num_items = 2, |
| 6646 | .items = { |
| 6647 | { "Mic", 0x0 }, |
| 6648 | { "Int Mic", 0x1 }, |
| 6649 | }, |
| 6650 | }; |
| 6651 | |
| 6652 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 6653 | .num_items = 3, |
| 6654 | .items = { |
| 6655 | { "Mic", 0x0 }, |
| 6656 | { "Front Mic", 0x1 }, |
| 6657 | { "Line", 0x4 }, |
| 6658 | }, |
| 6659 | }; |
| 6660 | |
| 6661 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 6662 | .num_items = 2, |
| 6663 | .items = { |
| 6664 | { "Mic", 0x0 }, |
| 6665 | { "Line", 0x2 }, |
| 6666 | }, |
| 6667 | }; |
| 6668 | |
| 6669 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 6670 | .num_items = 2, |
| 6671 | .items = { |
| 6672 | { "Mic", 0x0 }, |
| 6673 | /* Front Mic (0x01) unused */ |
| 6674 | { "Line", 0x2 }, |
| 6675 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 6676 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6677 | }, |
| 6678 | }; |
| 6679 | |
| 6680 | /* |
| 6681 | * 2ch mode |
| 6682 | */ |
| 6683 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6684 | { 2, NULL } |
| 6685 | }; |
| 6686 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6687 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6688 | * 2ch mode |
| 6689 | */ |
| 6690 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 6691 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6692 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6693 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6694 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6695 | { } /* end */ |
| 6696 | }; |
| 6697 | |
| 6698 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6699 | * 4ch mode |
| 6700 | */ |
| 6701 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 6702 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6703 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6704 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6705 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6706 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6707 | { } /* end */ |
| 6708 | }; |
| 6709 | |
| 6710 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6711 | * 6ch mode |
| 6712 | */ |
| 6713 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 6714 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6715 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6716 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6717 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6718 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6719 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6720 | { } /* end */ |
| 6721 | }; |
| 6722 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6723 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6724 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6725 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6726 | { 6, alc882_3ST_ch6_init }, |
| 6727 | }; |
| 6728 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6729 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 6730 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6731 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 6732 | * 2ch mode |
| 6733 | */ |
| 6734 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 6735 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 6736 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6737 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6738 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6739 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6740 | { } /* end */ |
| 6741 | }; |
| 6742 | |
| 6743 | /* |
| 6744 | * 4ch mode |
| 6745 | */ |
| 6746 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 6747 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6748 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6749 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6750 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6751 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6752 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6753 | { } /* end */ |
| 6754 | }; |
| 6755 | |
| 6756 | /* |
| 6757 | * 6ch mode |
| 6758 | */ |
| 6759 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 6760 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6761 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6762 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6763 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6764 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6765 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6766 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6767 | { } /* end */ |
| 6768 | }; |
| 6769 | |
| 6770 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 6771 | { 2, alc883_3ST_ch2_clevo_init }, |
| 6772 | { 4, alc883_3ST_ch4_clevo_init }, |
| 6773 | { 6, alc883_3ST_ch6_clevo_init }, |
| 6774 | }; |
| 6775 | |
| 6776 | |
| 6777 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6778 | * 6ch mode |
| 6779 | */ |
| 6780 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 6781 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6782 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6783 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6784 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6785 | { } /* end */ |
| 6786 | }; |
| 6787 | |
| 6788 | /* |
| 6789 | * 8ch mode |
| 6790 | */ |
| 6791 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 6792 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6793 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6794 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6795 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6796 | { } /* end */ |
| 6797 | }; |
| 6798 | |
| 6799 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 6800 | { 6, alc882_sixstack_ch6_init }, |
| 6801 | { 8, alc882_sixstack_ch8_init }, |
| 6802 | }; |
| 6803 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6804 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 6805 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6806 | */ |
| 6807 | |
| 6808 | /* |
| 6809 | * 2ch mode |
| 6810 | */ |
| 6811 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 6812 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6813 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6814 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6815 | { } /* end */ |
| 6816 | }; |
| 6817 | |
| 6818 | /* |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 6819 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6820 | */ |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 6821 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6822 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6823 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6824 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6825 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6826 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6827 | { } /* end */ |
| 6828 | }; |
| 6829 | |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 6830 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6831 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 6832 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6833 | }; |
| 6834 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6835 | /* |
| 6836 | * 2ch |
| 6837 | * Speakers/Woofer/HP = Front |
| 6838 | * LineIn = Input |
| 6839 | */ |
| 6840 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 6841 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6842 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6843 | { } /* end */ |
| 6844 | }; |
| 6845 | |
| 6846 | /* |
| 6847 | * 6ch mode |
| 6848 | * Speakers/HP = Front |
| 6849 | * Woofer = LFE |
| 6850 | * LineIn = Surround |
| 6851 | */ |
| 6852 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 6853 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6854 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6855 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6856 | { } /* end */ |
| 6857 | }; |
| 6858 | |
| 6859 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 6860 | { 2, alc885_mb5_ch2_init }, |
| 6861 | { 6, alc885_mb5_ch6_init }, |
| 6862 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6863 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6864 | |
| 6865 | /* |
| 6866 | * 2ch mode |
| 6867 | */ |
| 6868 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 6869 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6870 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6871 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6872 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6873 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6874 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6875 | { } /* end */ |
| 6876 | }; |
| 6877 | |
| 6878 | /* |
| 6879 | * 4ch mode |
| 6880 | */ |
| 6881 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 6882 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6883 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6884 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6885 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6886 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6887 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6888 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6889 | { } /* end */ |
| 6890 | }; |
| 6891 | |
| 6892 | /* |
| 6893 | * 6ch mode |
| 6894 | */ |
| 6895 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 6896 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6897 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6898 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6899 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6900 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6901 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6902 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6903 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6904 | { } /* end */ |
| 6905 | }; |
| 6906 | |
| 6907 | /* |
| 6908 | * 8ch mode |
| 6909 | */ |
| 6910 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 6911 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6912 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6913 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6914 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6915 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6916 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6917 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6918 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6919 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6920 | { } /* end */ |
| 6921 | }; |
| 6922 | |
| 6923 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 6924 | { 2, alc883_4ST_ch2_init }, |
| 6925 | { 4, alc883_4ST_ch4_init }, |
| 6926 | { 6, alc883_4ST_ch6_init }, |
| 6927 | { 8, alc883_4ST_ch8_init }, |
| 6928 | }; |
| 6929 | |
| 6930 | |
| 6931 | /* |
| 6932 | * 2ch mode |
| 6933 | */ |
| 6934 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 6935 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6936 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6937 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6938 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6939 | { } /* end */ |
| 6940 | }; |
| 6941 | |
| 6942 | /* |
| 6943 | * 4ch mode |
| 6944 | */ |
| 6945 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 6946 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6947 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6948 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6949 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6950 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6951 | { } /* end */ |
| 6952 | }; |
| 6953 | |
| 6954 | /* |
| 6955 | * 6ch mode |
| 6956 | */ |
| 6957 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 6958 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6959 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6960 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6961 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6962 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6963 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6964 | { } /* end */ |
| 6965 | }; |
| 6966 | |
| 6967 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 6968 | { 2, alc883_3ST_ch2_intel_init }, |
| 6969 | { 4, alc883_3ST_ch4_intel_init }, |
| 6970 | { 6, alc883_3ST_ch6_intel_init }, |
| 6971 | }; |
| 6972 | |
| 6973 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6974 | * 2ch mode |
| 6975 | */ |
| 6976 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 6977 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6978 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6979 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6980 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6981 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6982 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6983 | { } /* end */ |
| 6984 | }; |
| 6985 | |
| 6986 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6987 | * 6ch mode |
| 6988 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6989 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6990 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6991 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6992 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6993 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6994 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6995 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6996 | { } /* end */ |
| 6997 | }; |
| 6998 | |
| 6999 | /* |
| 7000 | * 8ch mode |
| 7001 | */ |
| 7002 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7003 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7004 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7005 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7006 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7007 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7008 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7009 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7010 | { } /* end */ |
| 7011 | }; |
| 7012 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7013 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 7014 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7015 | { 6, alc889_ch6_intel_init }, |
| 7016 | { 8, alc889_ch8_intel_init }, |
| 7017 | }; |
| 7018 | |
| 7019 | /* |
| 7020 | * 6ch mode |
| 7021 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7022 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7023 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7024 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7025 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7026 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7027 | { } /* end */ |
| 7028 | }; |
| 7029 | |
| 7030 | /* |
| 7031 | * 8ch mode |
| 7032 | */ |
| 7033 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7034 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7035 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7036 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7037 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7038 | { } /* end */ |
| 7039 | }; |
| 7040 | |
| 7041 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7042 | { 6, alc883_sixstack_ch6_init }, |
| 7043 | { 8, alc883_sixstack_ch8_init }, |
| 7044 | }; |
| 7045 | |
| 7046 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7047 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7048 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7049 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 7050 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7051 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7052 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7053 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7054 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7055 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7056 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7057 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7058 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7059 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7060 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7061 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7062 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7063 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 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, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7067 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7068 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7069 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7070 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7071 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7072 | { } /* end */ |
| 7073 | }; |
| 7074 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7075 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7076 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7077 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7078 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7079 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7080 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7081 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7082 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7083 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7084 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7085 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7086 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7087 | { } /* end */ |
| 7088 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7089 | |
| 7090 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7091 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7092 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7093 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7094 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7095 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7096 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame^] | 7097 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7098 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7099 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7100 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7101 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7102 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7103 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7104 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 7105 | { } /* end */ |
| 7106 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7107 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7108 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
| 7109 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7110 | HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7111 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 7112 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 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("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7116 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 7117 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7118 | { } /* end */ |
| 7119 | }; |
| 7120 | |
| 7121 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7122 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 7123 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7124 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7125 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7126 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7127 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7128 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7129 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7130 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7131 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7132 | { } /* end */ |
| 7133 | }; |
| 7134 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7135 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 7136 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7137 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7138 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7139 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7140 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7141 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7142 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7143 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7144 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7145 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7146 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7147 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7148 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7149 | { } /* end */ |
| 7150 | }; |
| 7151 | |
| 7152 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 7153 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 7154 | */ |
| 7155 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 7156 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7157 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7158 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7159 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 7160 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7161 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7162 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7163 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7164 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 7165 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 7166 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7167 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7168 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7169 | { } /* end */ |
| 7170 | }; |
| 7171 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7172 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 7173 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7174 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7175 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7176 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7177 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7178 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7179 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7180 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7181 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7182 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7183 | { } /* end */ |
| 7184 | }; |
| 7185 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7186 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 7187 | { |
| 7188 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7189 | .name = "Channel Mode", |
| 7190 | .info = alc_ch_mode_info, |
| 7191 | .get = alc_ch_mode_get, |
| 7192 | .put = alc_ch_mode_put, |
| 7193 | }, |
| 7194 | { } /* end */ |
| 7195 | }; |
| 7196 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7197 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7198 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7199 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7200 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7201 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7202 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7203 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7204 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7205 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7206 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7207 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7208 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7209 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7210 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7211 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7212 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7213 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7214 | |
Takashi Iwai | cb63812 | 2009-07-03 10:56:10 +0200 | [diff] [blame] | 7215 | /* mute analog input loopbacks */ |
| 7216 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7217 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7218 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7219 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7220 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7221 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7222 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7223 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7224 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7225 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7226 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7227 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7228 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7229 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7230 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7231 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7232 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7233 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7234 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7235 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7236 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7237 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7238 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7239 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7240 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7241 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7242 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7243 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7244 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7245 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7246 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7247 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7248 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7249 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7250 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7251 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7252 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7253 | |
| 7254 | /* FIXME: use matrix-type input source selection */ |
| 7255 | /* 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] | 7256 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7257 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7258 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7259 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7260 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7261 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7262 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7263 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7264 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7265 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7266 | /* ADC2: mute amp left and right */ |
| 7267 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7268 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7269 | /* ADC3: mute amp left and right */ |
| 7270 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7271 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7272 | |
| 7273 | { } |
| 7274 | }; |
| 7275 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7276 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 7277 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7278 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7279 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7280 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7281 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7282 | /* ADC1: mute amp left and right */ |
| 7283 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7284 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7285 | { } |
| 7286 | }; |
| 7287 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7288 | static struct hda_verb alc882_eapd_verbs[] = { |
| 7289 | /* change to EAPD mode */ |
| 7290 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7291 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7292 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7293 | }; |
| 7294 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7295 | static struct hda_verb alc889_eapd_verbs[] = { |
| 7296 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7297 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7298 | { } |
| 7299 | }; |
| 7300 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7301 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 7302 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7303 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7304 | {} |
| 7305 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7306 | |
| 7307 | static struct hda_verb alc885_init_verbs[] = { |
| 7308 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7309 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7310 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7311 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7312 | /* Rear mixer */ |
| 7313 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7314 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7315 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7316 | /* CLFE mixer */ |
| 7317 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7318 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7319 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7320 | /* Side mixer */ |
| 7321 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7322 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7323 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7324 | |
| 7325 | /* mute analog input loopbacks */ |
| 7326 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7327 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7328 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7329 | |
| 7330 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7331 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7332 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7333 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7334 | /* Front Pin: output 0 (0x0c) */ |
| 7335 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7336 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7337 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7338 | /* Rear Pin: output 1 (0x0d) */ |
| 7339 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7340 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7341 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7342 | /* CLFE Pin: output 2 (0x0e) */ |
| 7343 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7344 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7345 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7346 | /* Side Pin: output 3 (0x0f) */ |
| 7347 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7348 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7349 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7350 | /* Mic (rear) pin: input vref at 80% */ |
| 7351 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7352 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7353 | /* Front Mic pin: input vref at 80% */ |
| 7354 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7355 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7356 | /* Line In pin: input */ |
| 7357 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7358 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7359 | |
| 7360 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 7361 | /* Input mixer1 */ |
| 7362 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7363 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7364 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7365 | /* Input mixer2 */ |
| 7366 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7367 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7368 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7369 | /* Input mixer3 */ |
| 7370 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7371 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7372 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7373 | /* ADC2: mute amp left and right */ |
| 7374 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7375 | /* ADC3: mute amp left and right */ |
| 7376 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7377 | |
| 7378 | { } |
| 7379 | }; |
| 7380 | |
| 7381 | static struct hda_verb alc885_init_input_verbs[] = { |
| 7382 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7383 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7384 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7385 | { } |
| 7386 | }; |
| 7387 | |
| 7388 | |
| 7389 | /* Unmute Selector 24h and set the default input to front mic */ |
| 7390 | static struct hda_verb alc889_init_input_verbs[] = { |
| 7391 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7392 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7393 | { } |
| 7394 | }; |
| 7395 | |
| 7396 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7397 | #define alc883_init_verbs alc882_base_init_verbs |
| 7398 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7399 | /* Mac Pro test */ |
| 7400 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 7401 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7402 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7403 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 7404 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7405 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7406 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 7407 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7408 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7409 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7410 | { } /* end */ |
| 7411 | }; |
| 7412 | |
| 7413 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 7414 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7415 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7416 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7417 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7418 | /* Front Pin: output 0 (0x0c) */ |
| 7419 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7420 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7421 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7422 | /* Front Mic pin: input vref at 80% */ |
| 7423 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7424 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7425 | /* Speaker: output */ |
| 7426 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7427 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7428 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 7429 | /* Headphone output (output 0 - 0x0c) */ |
| 7430 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7431 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7432 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7433 | |
| 7434 | /* FIXME: use matrix-type input source selection */ |
| 7435 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7436 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7437 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7438 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7439 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7440 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7441 | /* Input mixer2 */ |
| 7442 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7443 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7444 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7445 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7446 | /* Input mixer3 */ |
| 7447 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7448 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7449 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7450 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7451 | /* ADC1: mute amp left and right */ |
| 7452 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7453 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7454 | /* ADC2: mute amp left and right */ |
| 7455 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7456 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7457 | /* ADC3: mute amp left and right */ |
| 7458 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7459 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7460 | |
| 7461 | { } |
| 7462 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7463 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7464 | /* Macbook 5,1 */ |
| 7465 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7466 | /* DACs */ |
| 7467 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7468 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7469 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7470 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7471 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7472 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7473 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7474 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7475 | /* Surround mixer */ |
| 7476 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7477 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7478 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7479 | /* LFE mixer */ |
| 7480 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7481 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7482 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7483 | /* HP mixer */ |
| 7484 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7485 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7486 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7487 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7488 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7489 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7490 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7491 | /* LFE Pin (0x0e) */ |
| 7492 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7493 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7494 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7495 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7496 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7497 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7498 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame^] | 7499 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7500 | /* Front Mic pin: input vref at 80% */ |
| 7501 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7502 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7503 | /* Line In pin */ |
| 7504 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7505 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7506 | |
| 7507 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7508 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7509 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7510 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7511 | { } |
| 7512 | }; |
| 7513 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7514 | /* Macbook Pro rev3 */ |
| 7515 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 7516 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7517 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7518 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7519 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7520 | /* Rear mixer */ |
| 7521 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7522 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7523 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7524 | /* HP mixer */ |
| 7525 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7526 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7527 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7528 | /* Front Pin: output 0 (0x0c) */ |
| 7529 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7530 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7531 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7532 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7533 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7534 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7535 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7536 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7537 | /* Mic (rear) pin: input vref at 80% */ |
| 7538 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7539 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7540 | /* Front Mic pin: input vref at 80% */ |
| 7541 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7542 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7543 | /* Line In pin: use output 1 when in LineOut mode */ |
| 7544 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7545 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7546 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7547 | |
| 7548 | /* FIXME: use matrix-type input source selection */ |
| 7549 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7550 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7551 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7552 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7553 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7554 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7555 | /* Input mixer2 */ |
| 7556 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7557 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7558 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7559 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7560 | /* Input mixer3 */ |
| 7561 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7562 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7563 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7564 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7565 | /* ADC1: mute amp left and right */ |
| 7566 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7567 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7568 | /* ADC2: mute amp left and right */ |
| 7569 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7570 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7571 | /* ADC3: mute amp left and right */ |
| 7572 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7573 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7574 | |
| 7575 | { } |
| 7576 | }; |
| 7577 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7578 | /* iMac 9,1 */ |
| 7579 | static struct hda_verb alc885_imac91_init_verbs[] = { |
| 7580 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 7581 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7582 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7583 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7584 | /* Rear mixer */ |
| 7585 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7586 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7587 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7588 | /* HP Pin: output 0 (0x0c) */ |
| 7589 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7590 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7591 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7592 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7593 | /* Internal Speakers: output 0 (0x0d) */ |
| 7594 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7595 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7596 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7597 | /* Mic (rear) pin: input vref at 80% */ |
| 7598 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7599 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7600 | /* Front Mic pin: input vref at 80% */ |
| 7601 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7602 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7603 | /* Line In pin: use output 1 when in LineOut mode */ |
| 7604 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7605 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7606 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7607 | |
| 7608 | /* FIXME: use matrix-type input source selection */ |
| 7609 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7610 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7611 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7612 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7613 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7614 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7615 | /* Input mixer2 */ |
| 7616 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7617 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7618 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7619 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7620 | /* Input mixer3 */ |
| 7621 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7622 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7623 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7624 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7625 | /* ADC1: mute amp left and right */ |
| 7626 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7627 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7628 | /* ADC2: mute amp left and right */ |
| 7629 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7630 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7631 | /* ADC3: mute amp left and right */ |
| 7632 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7633 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7634 | |
| 7635 | { } |
| 7636 | }; |
| 7637 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7638 | /* iMac 24 mixer. */ |
| 7639 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 7640 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7641 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 7642 | { } /* end */ |
| 7643 | }; |
| 7644 | |
| 7645 | /* iMac 24 init verbs. */ |
| 7646 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 7647 | /* Internal speakers: output 0 (0x0c) */ |
| 7648 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7649 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7650 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7651 | /* Internal speakers: output 0 (0x0c) */ |
| 7652 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7653 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7654 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7655 | /* Headphone: output 0 (0x0c) */ |
| 7656 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7657 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7658 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7659 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7660 | /* Front Mic: input vref at 80% */ |
| 7661 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7662 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7663 | { } |
| 7664 | }; |
| 7665 | |
| 7666 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7667 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7668 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7669 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7670 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7671 | spec->autocfg.hp_pins[0] = 0x14; |
| 7672 | spec->autocfg.speaker_pins[0] = 0x18; |
| 7673 | spec->autocfg.speaker_pins[1] = 0x1a; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7674 | } |
| 7675 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7676 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7677 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7678 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7679 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7680 | spec->autocfg.hp_pins[0] = 0x15; |
| 7681 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7682 | } |
| 7683 | |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame^] | 7684 | static void alc885_mb5_automute(struct hda_codec *codec) |
| 7685 | { |
| 7686 | unsigned int present; |
| 7687 | |
| 7688 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7689 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7690 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 7691 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7692 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 7693 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7694 | |
| 7695 | } |
| 7696 | |
| 7697 | static void alc885_mb5_unsol_event(struct hda_codec *codec, |
| 7698 | unsigned int res) |
| 7699 | { |
| 7700 | /* Headphone insertion or removal. */ |
| 7701 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7702 | alc885_mb5_automute(codec); |
| 7703 | } |
| 7704 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7705 | static void alc885_imac91_automute(struct hda_codec *codec) |
| 7706 | { |
| 7707 | unsigned int present; |
| 7708 | |
| 7709 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7710 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7711 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7712 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7713 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 7714 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7715 | |
| 7716 | } |
| 7717 | |
| 7718 | static void alc885_imac91_unsol_event(struct hda_codec *codec, |
| 7719 | unsigned int res) |
| 7720 | { |
| 7721 | /* Headphone insertion or removal. */ |
| 7722 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7723 | alc885_imac91_automute(codec); |
| 7724 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7725 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7726 | static struct hda_verb alc882_targa_verbs[] = { |
| 7727 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7728 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7729 | |
| 7730 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7731 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7732 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7733 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7734 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7735 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7736 | |
| 7737 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7738 | { } /* end */ |
| 7739 | }; |
| 7740 | |
| 7741 | /* toggle speaker-output according to the hp-jack state */ |
| 7742 | static void alc882_targa_automute(struct hda_codec *codec) |
| 7743 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7744 | struct alc_spec *spec = codec->spec; |
| 7745 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7746 | 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] | 7747 | spec->jack_present ? 1 : 3); |
| 7748 | } |
| 7749 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7750 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7751 | { |
| 7752 | struct alc_spec *spec = codec->spec; |
| 7753 | |
| 7754 | spec->autocfg.hp_pins[0] = 0x14; |
| 7755 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7756 | } |
| 7757 | |
| 7758 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7759 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7760 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7761 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7762 | } |
| 7763 | |
| 7764 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 7765 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7766 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7767 | |
| 7768 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7769 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7770 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7771 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7772 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7773 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7774 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7775 | |
| 7776 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7777 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7778 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7779 | { } /* end */ |
| 7780 | }; |
| 7781 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7782 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 7783 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7784 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7785 | |
| 7786 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7787 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7788 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7789 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7790 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7791 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7792 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7793 | |
| 7794 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7795 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7796 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7797 | { } /* end */ |
| 7798 | }; |
| 7799 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7800 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 7801 | { |
| 7802 | unsigned int gpiostate, gpiomask, gpiodir; |
| 7803 | |
| 7804 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 7805 | AC_VERB_GET_GPIO_DATA, 0); |
| 7806 | |
| 7807 | if (!muted) |
| 7808 | gpiostate |= (1 << pin); |
| 7809 | else |
| 7810 | gpiostate &= ~(1 << pin); |
| 7811 | |
| 7812 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 7813 | AC_VERB_GET_GPIO_MASK, 0); |
| 7814 | gpiomask |= (1 << pin); |
| 7815 | |
| 7816 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 7817 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 7818 | gpiodir |= (1 << pin); |
| 7819 | |
| 7820 | |
| 7821 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7822 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 7823 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7824 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 7825 | |
| 7826 | msleep(1); |
| 7827 | |
| 7828 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7829 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 7830 | } |
| 7831 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7832 | /* set up GPIO at initialization */ |
| 7833 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 7834 | { |
| 7835 | alc882_gpio_mute(codec, 0, 0); |
| 7836 | alc882_gpio_mute(codec, 1, 0); |
| 7837 | } |
| 7838 | |
| 7839 | /* set up GPIO and update auto-muting at initialization */ |
| 7840 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 7841 | { |
| 7842 | alc885_macpro_init_hook(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7843 | alc_automute_amp(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7844 | } |
| 7845 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7846 | /* |
| 7847 | * generic initialization of ADC, input mixers and output mixers |
| 7848 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7849 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7850 | /* |
| 7851 | * Unmute ADC0-2 and set the default input to mic-in |
| 7852 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7853 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7854 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7855 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7856 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7857 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7858 | /* 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] | 7859 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7860 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7861 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7862 | */ |
| 7863 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7864 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7865 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7866 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7867 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7868 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7869 | |
| 7870 | /* |
| 7871 | * Set up output mixers (0x0c - 0x0f) |
| 7872 | */ |
| 7873 | /* set vol=0 to output mixers */ |
| 7874 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7875 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7876 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7877 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7878 | /* set up input amps for analog loopback */ |
| 7879 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7880 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7881 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7882 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7883 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7884 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7885 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7886 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7887 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7888 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7889 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7890 | |
| 7891 | /* FIXME: use matrix-type input source selection */ |
| 7892 | /* 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] | 7893 | /* Input mixer2 */ |
| 7894 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7895 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7896 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7897 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7898 | /* Input mixer3 */ |
| 7899 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7900 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7901 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7902 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7903 | |
| 7904 | { } |
| 7905 | }; |
| 7906 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7907 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 7908 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 7909 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7910 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7911 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7912 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7913 | { } /* end */ |
| 7914 | }; |
| 7915 | |
| 7916 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 7917 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 7918 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7919 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7920 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7921 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7922 | { } /* end */ |
| 7923 | }; |
| 7924 | |
| 7925 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 7926 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 7927 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 7928 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7929 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7930 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7931 | { } /* end */ |
| 7932 | }; |
| 7933 | |
| 7934 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 7935 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 7936 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 7937 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 7938 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7939 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7940 | { } /* end */ |
| 7941 | }; |
| 7942 | |
| 7943 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 7944 | { 2, alc889A_mb31_ch2_init }, |
| 7945 | { 4, alc889A_mb31_ch4_init }, |
| 7946 | { 5, alc889A_mb31_ch5_init }, |
| 7947 | { 6, alc889A_mb31_ch6_init }, |
| 7948 | }; |
| 7949 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7950 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7951 | /* eanable EAPD on medion laptop */ |
| 7952 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7953 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7954 | { } |
| 7955 | }; |
| 7956 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7957 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7958 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7959 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7960 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7961 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7962 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7963 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7964 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7965 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7966 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7967 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7968 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7969 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7970 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7971 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7972 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7973 | { } /* end */ |
| 7974 | }; |
| 7975 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7976 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7977 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7978 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7979 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7980 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7981 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7982 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7983 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7984 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7985 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7986 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7987 | { } /* end */ |
| 7988 | }; |
| 7989 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7990 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7991 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7992 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7993 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7994 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7995 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7996 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7997 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7998 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7999 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8000 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8001 | { } /* end */ |
| 8002 | }; |
| 8003 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8004 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 8005 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8006 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8007 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8008 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8009 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 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, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8013 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8014 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8015 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8016 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8017 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8018 | { } /* end */ |
| 8019 | }; |
| 8020 | |
| 8021 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 8022 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8023 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8024 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8025 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 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), |
| 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), |
| 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), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +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), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8040 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8041 | { } /* end */ |
| 8042 | }; |
| 8043 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8044 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 8045 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8046 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8047 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8048 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8049 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8050 | HDA_OUTPUT), |
| 8051 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8052 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8053 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8054 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 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, 0x1, HDA_INPUT), |
| 8060 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8061 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8062 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8063 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8064 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8065 | { } /* end */ |
| 8066 | }; |
| 8067 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8068 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 8069 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8070 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8071 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8072 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8073 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8074 | HDA_OUTPUT), |
| 8075 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8076 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8077 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8078 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8079 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8080 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8081 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8082 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8083 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 8084 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), |
| 8085 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 8086 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8087 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8088 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8089 | { } /* end */ |
| 8090 | }; |
| 8091 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8092 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8093 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8094 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8095 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8096 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8097 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8098 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8099 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8100 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8101 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8102 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8103 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8104 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8105 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8106 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8107 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8108 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8109 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8110 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8111 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8112 | { } /* end */ |
| 8113 | }; |
| 8114 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8115 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8116 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8117 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8118 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8119 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8120 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8121 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8122 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8123 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8124 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8125 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8126 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8127 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8128 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8129 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8130 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8131 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8132 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8133 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8134 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8135 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8136 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8137 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8138 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8139 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8140 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8141 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8142 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8143 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8144 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8145 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8146 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8147 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8148 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8149 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8150 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8151 | |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8152 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
| 8153 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8154 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8155 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8156 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8157 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8158 | { } /* end */ |
| 8159 | }; |
| 8160 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8161 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 8162 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8163 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8164 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8165 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8166 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8167 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8168 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8169 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8170 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8171 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8172 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8173 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 8174 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8175 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8176 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8177 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8178 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8179 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8180 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8181 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8182 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8183 | { } /* end */ |
| 8184 | }; |
| 8185 | |
| 8186 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 8187 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8188 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8189 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8190 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8191 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8192 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8193 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8194 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8195 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8196 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8197 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8198 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8199 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8200 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8201 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8202 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8203 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8204 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8205 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8206 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8207 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8208 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8209 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8210 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8211 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 8212 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8213 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8214 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8215 | HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 8216 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8217 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8218 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8219 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8220 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8221 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8222 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8223 | { } /* end */ |
| 8224 | }; |
| 8225 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8226 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 8227 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8228 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8229 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8230 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 8231 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 8232 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 8233 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 8234 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 8235 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 8236 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8237 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8238 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8239 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8240 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8241 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8242 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8243 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8244 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8245 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8246 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8247 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8248 | { } /* end */ |
| 8249 | }; |
| 8250 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8251 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 8252 | /* Output mixers */ |
| 8253 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8254 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8255 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8256 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8257 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 8258 | HDA_OUTPUT), |
| 8259 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 8260 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 8261 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 8262 | /* Output switches */ |
| 8263 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 8264 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 8265 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 8266 | /* Boost mixers */ |
| 8267 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 8268 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 8269 | /* Input mixers */ |
| 8270 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8271 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 8272 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8273 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8274 | { } /* end */ |
| 8275 | }; |
| 8276 | |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8277 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 8278 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8279 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8280 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8281 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8282 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8283 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8284 | { } /* end */ |
| 8285 | }; |
| 8286 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8287 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 8288 | .ops = &snd_hda_bind_vol, |
| 8289 | .values = { |
| 8290 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8291 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8292 | 0 |
| 8293 | }, |
| 8294 | }; |
| 8295 | |
| 8296 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 8297 | .ops = &snd_hda_bind_sw, |
| 8298 | .values = { |
| 8299 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8300 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8301 | 0 |
| 8302 | }, |
| 8303 | }; |
| 8304 | |
| 8305 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 8306 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8307 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8308 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8309 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8310 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8311 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8312 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8313 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8314 | { } /* end */ |
| 8315 | }; |
| 8316 | |
| 8317 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8318 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 8319 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 8320 | { |
| 8321 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8322 | /* .name = "Capture Source", */ |
| 8323 | .name = "Input Source", |
| 8324 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 8325 | .info = alc_mux_enum_info, |
| 8326 | .get = alc_mux_enum_get, |
| 8327 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8328 | }, |
| 8329 | { } /* end */ |
| 8330 | }; |
| 8331 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8332 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 8333 | { |
| 8334 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8335 | .name = "Channel Mode", |
| 8336 | .info = alc_ch_mode_info, |
| 8337 | .get = alc_ch_mode_get, |
| 8338 | .put = alc_ch_mode_put, |
| 8339 | }, |
| 8340 | { } /* end */ |
| 8341 | }; |
| 8342 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8343 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8344 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8345 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8346 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8347 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8348 | spec->autocfg.hp_pins[0] = 0x15; |
| 8349 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8350 | spec->autocfg.speaker_pins[1] = 0x17; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8351 | } |
| 8352 | |
| 8353 | /* auto-toggle front mic */ |
| 8354 | /* |
| 8355 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 8356 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8357 | 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] | 8358 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8359 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 8360 | } |
| 8361 | */ |
| 8362 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8363 | static struct hda_verb alc883_mitac_verbs[] = { |
| 8364 | /* HP */ |
| 8365 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8366 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8367 | /* Subwoofer */ |
| 8368 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8369 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8370 | |
| 8371 | /* enable unsolicited event */ |
| 8372 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8373 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 8374 | |
| 8375 | { } /* end */ |
| 8376 | }; |
| 8377 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 8378 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 8379 | /* HP */ |
| 8380 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8381 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8382 | /* Int speaker */ |
| 8383 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 8384 | |
| 8385 | /* enable unsolicited event */ |
| 8386 | /* |
| 8387 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8388 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8389 | */ |
| 8390 | |
| 8391 | { } /* end */ |
| 8392 | }; |
| 8393 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8394 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8395 | /* HP */ |
| 8396 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8397 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8398 | /* Int speaker */ |
| 8399 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8400 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8401 | |
| 8402 | /* enable unsolicited event */ |
| 8403 | {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] | 8404 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8405 | |
| 8406 | { } /* end */ |
| 8407 | }; |
| 8408 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8409 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 8410 | /* HP */ |
| 8411 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8412 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8413 | /* Subwoofer */ |
| 8414 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8415 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8416 | |
| 8417 | /* enable unsolicited event */ |
| 8418 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8419 | |
| 8420 | { } /* end */ |
| 8421 | }; |
| 8422 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8423 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8424 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8425 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8426 | |
| 8427 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8428 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8429 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8430 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 8431 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8432 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8433 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8434 | /* Connect Mic jack to CLFE */ |
| 8435 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8436 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8437 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8438 | /* Connect Line-in jack to Surround */ |
| 8439 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8440 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8441 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8442 | /* Connect HP out jack to Front */ |
| 8443 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8444 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8445 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8446 | |
| 8447 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8448 | |
| 8449 | { } /* end */ |
| 8450 | }; |
| 8451 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8452 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8453 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8454 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8455 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8456 | { } /* end */ |
| 8457 | }; |
| 8458 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8459 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8460 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8461 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8462 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8463 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8464 | { } /* end */ |
| 8465 | }; |
| 8466 | |
| 8467 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8468 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8469 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8470 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8471 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 8472 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8473 | { } /* end */ |
| 8474 | }; |
| 8475 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8476 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 8477 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8478 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8479 | |
| 8480 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8481 | |
| 8482 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8483 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8484 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8485 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8486 | { } /* end */ |
| 8487 | }; |
| 8488 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8489 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 8490 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8491 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8492 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8493 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8494 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8495 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8496 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8497 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8498 | { } /* end */ |
| 8499 | }; |
| 8500 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8501 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 8502 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8503 | { } |
| 8504 | }; |
| 8505 | |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8506 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 8507 | /* HP */ |
| 8508 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8509 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8510 | |
| 8511 | /* enable unsolicited event */ |
| 8512 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8513 | |
| 8514 | { } /* end */ |
| 8515 | }; |
| 8516 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8517 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8518 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8519 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8520 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8521 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8522 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8523 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8524 | spec->autocfg.speaker_pins[2] = 0x18; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8525 | } |
| 8526 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8527 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8528 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 8529 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 8530 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8531 | {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] | 8532 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8533 | }; |
| 8534 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8535 | /* |
| 8536 | * 2ch mode |
| 8537 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8538 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8539 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8540 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8541 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8542 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8543 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8544 | }; |
| 8545 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8546 | /* |
| 8547 | * 4ch mode |
| 8548 | */ |
| 8549 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 8550 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8551 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8552 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8553 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8554 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8555 | { } /* end */ |
| 8556 | }; |
| 8557 | |
| 8558 | /* |
| 8559 | * 6ch mode |
| 8560 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8561 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8562 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8563 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8564 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8565 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8566 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8567 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8568 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8569 | }; |
| 8570 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8571 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8572 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8573 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8574 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8575 | }; |
| 8576 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8577 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 8578 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 8579 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8580 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8581 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8582 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8583 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8584 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8585 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8586 | } |
| 8587 | |
| 8588 | /* toggle RCA according to the front-jack state */ |
| 8589 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 8590 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8591 | unsigned int present = snd_hda_jack_detect(codec, 0x14); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8592 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8593 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8594 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8595 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8596 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8597 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 8598 | unsigned int res) |
| 8599 | { |
| 8600 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8601 | alc888_lenovo_ms7195_front_automute(codec); |
| 8602 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8603 | alc888_lenovo_ms7195_rca_automute(codec); |
| 8604 | } |
| 8605 | |
| 8606 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8607 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8608 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8609 | |
| 8610 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8611 | |
| 8612 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8613 | { } /* end */ |
| 8614 | }; |
| 8615 | |
| 8616 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8617 | static void alc883_medion_md2_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8618 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8619 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8620 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8621 | spec->autocfg.hp_pins[0] = 0x14; |
| 8622 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8623 | } |
| 8624 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8625 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8626 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 8627 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8628 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8629 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8630 | { |
| 8631 | unsigned int present; |
| 8632 | |
Takashi Iwai | d56757a | 2009-11-18 08:00:14 +0100 | [diff] [blame] | 8633 | present = snd_hda_jack_detect(codec, 0x18); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8634 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8635 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8636 | } |
| 8637 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8638 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8639 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8640 | struct alc_spec *spec = codec->spec; |
| 8641 | |
| 8642 | spec->autocfg.hp_pins[0] = 0x15; |
| 8643 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8644 | } |
| 8645 | |
| 8646 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 8647 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8648 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8649 | alc883_clevo_m720_mic_automute(codec); |
| 8650 | } |
| 8651 | |
| 8652 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8653 | unsigned int res) |
| 8654 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8655 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8656 | case ALC880_MIC_EVENT: |
| 8657 | alc883_clevo_m720_mic_automute(codec); |
| 8658 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8659 | default: |
| 8660 | alc_automute_amp_unsol_event(codec, res); |
| 8661 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8662 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8663 | } |
| 8664 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8665 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8666 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8667 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8668 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8669 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8670 | spec->autocfg.hp_pins[0] = 0x14; |
| 8671 | spec->autocfg.speaker_pins[0] = 0x15; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8672 | } |
| 8673 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8674 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8675 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8676 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8677 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8678 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8679 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8680 | } |
| 8681 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8682 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 8683 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8684 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8685 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8686 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8687 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8688 | } |
| 8689 | |
| 8690 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 8691 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8692 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8693 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8694 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8695 | HDA_AMP_MUTE, bits); |
| 8696 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8697 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8698 | } |
| 8699 | |
| 8700 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 8701 | unsigned int res) |
| 8702 | { |
| 8703 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8704 | alc883_lenovo_101e_all_automute(codec); |
| 8705 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8706 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 8707 | } |
| 8708 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8709 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8710 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8711 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8712 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8713 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8714 | spec->autocfg.hp_pins[0] = 0x14; |
| 8715 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8716 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8717 | } |
| 8718 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8719 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 8720 | /* HP Pin: output 0 (0x0c) */ |
| 8721 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8722 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8723 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8724 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8725 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8726 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8727 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8728 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8729 | /* eanable EAPD on medion laptop */ |
| 8730 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8731 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8732 | /* enable unsolicited event */ |
| 8733 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8734 | { } |
| 8735 | }; |
| 8736 | |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 8737 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 8738 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8739 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8740 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8741 | { } /* end */ |
| 8742 | }; |
| 8743 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8744 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8745 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8746 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8747 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8748 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8749 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8750 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8751 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8752 | spec->autocfg.speaker_pins[3] = 0x17; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8753 | } |
| 8754 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8755 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8756 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8757 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8758 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8759 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8760 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8761 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8762 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8763 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8764 | spec->autocfg.speaker_pins[4] = 0x1a; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8765 | } |
| 8766 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8767 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8768 | { |
| 8769 | struct alc_spec *spec = codec->spec; |
| 8770 | |
| 8771 | spec->autocfg.hp_pins[0] = 0x15; |
| 8772 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8773 | spec->autocfg.speaker_pins[1] = 0x17; |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8774 | } |
| 8775 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8776 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8777 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8778 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8779 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8780 | /* enable unsolicited event */ |
| 8781 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8782 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8783 | { } /* end */ |
| 8784 | }; |
| 8785 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8786 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8787 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8788 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8789 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8790 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8791 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8792 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8793 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8794 | spec->ext_mic.pin = 0x18; |
| 8795 | spec->int_mic.pin = 0x19; |
| 8796 | spec->ext_mic.mux_idx = 0; |
| 8797 | spec->int_mic.mux_idx = 1; |
| 8798 | spec->auto_mic = 1; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8799 | } |
| 8800 | |
| 8801 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8802 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8803 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8804 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8805 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8806 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8807 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8808 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8809 | /* enable unsolicited event */ |
| 8810 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8811 | { } /* end */ |
| 8812 | }; |
| 8813 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8814 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8815 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8816 | struct alc_spec *spec = codec->spec; |
| 8817 | |
| 8818 | spec->autocfg.hp_pins[0] = 0x14; |
| 8819 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 8820 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8821 | } |
| 8822 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8823 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 8824 | /* Init rear pin (used as headphone output) */ |
| 8825 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 8826 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 8827 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8828 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 8829 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 8830 | /* Init line 2 pin (used as headphone out by default) */ |
| 8831 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 8832 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 8833 | { } /* end */ |
| 8834 | }; |
| 8835 | |
| 8836 | /* Mute speakers according to the headphone jack state */ |
| 8837 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 8838 | { |
| 8839 | unsigned int present; |
| 8840 | |
| 8841 | /* Mute only in 2ch or 4ch mode */ |
| 8842 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 8843 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8844 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8845 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8846 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8847 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8848 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8849 | } |
| 8850 | } |
| 8851 | |
| 8852 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8853 | { |
| 8854 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8855 | alc889A_mb31_automute(codec); |
| 8856 | } |
| 8857 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8858 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8859 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8860 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8861 | #endif |
| 8862 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 8863 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8864 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 8865 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 8866 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 8867 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 8868 | |
| 8869 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 8870 | ALC1200_DIGOUT_NID, 0, |
| 8871 | }; |
| 8872 | |
| 8873 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 8874 | ALC883_DIGOUT_NID, 0, |
| 8875 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8876 | |
| 8877 | /* |
| 8878 | * configuration and preset |
| 8879 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8880 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 8881 | [ALC882_3ST_DIG] = "3stack-dig", |
| 8882 | [ALC882_6ST_DIG] = "6stack-dig", |
| 8883 | [ALC882_ARIMA] = "arima", |
| 8884 | [ALC882_W2JC] = "w2jc", |
| 8885 | [ALC882_TARGA] = "targa", |
| 8886 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 8887 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 8888 | [ALC885_MACPRO] = "macpro", |
| 8889 | [ALC885_MB5] = "mb5", |
| 8890 | [ALC885_MBP3] = "mbp3", |
| 8891 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8892 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8893 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8894 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8895 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8896 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8897 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8898 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8899 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8900 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8901 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8902 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 8903 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8904 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 8905 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8906 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8907 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8908 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8909 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8910 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8911 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8912 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8913 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8914 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8915 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8916 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 8917 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8918 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8919 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8920 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8921 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8922 | [ALC889A_INTEL] = "intel-alc889a", |
| 8923 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8924 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8925 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8926 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8927 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8928 | }; |
| 8929 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8930 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 8931 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 8932 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8933 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 8934 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 8935 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8936 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8937 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8938 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8939 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 8940 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8941 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 8942 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8943 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 8944 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 8945 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 8946 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8947 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 8948 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8949 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 8950 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 8951 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8952 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 8953 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 8954 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 8955 | /* default Acer -- disabled as it causes more problems. |
| 8956 | * model=auto should work fine now |
| 8957 | */ |
| 8958 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8959 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8960 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8961 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8962 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8963 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8964 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8965 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 8966 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 8967 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8968 | |
| 8969 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 8970 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 8971 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 8972 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8973 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 8974 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 8975 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8976 | 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] | 8977 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8978 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8979 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8980 | |
| 8981 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 8982 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8983 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8984 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8985 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8986 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8987 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8988 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8989 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 8990 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8991 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8992 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8993 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8994 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 8995 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8996 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8997 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8998 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8999 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 9000 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 9001 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 9002 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 9003 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 9004 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9005 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9006 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 9007 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 9008 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9009 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9010 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 9011 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 9012 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 9013 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 9014 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 9015 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 9016 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 9017 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9018 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9019 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9020 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9021 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9022 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9023 | 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] | 9024 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9025 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9026 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9027 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9028 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9029 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9030 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9031 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9032 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9033 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9034 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9035 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 9036 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9037 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9038 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 9039 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 9040 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9041 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9042 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9043 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 9044 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9045 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9046 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 9047 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 9048 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9049 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9050 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9051 | {} |
| 9052 | }; |
| 9053 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9054 | /* codec SSID table for Intel Mac */ |
| 9055 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 9056 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 9057 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 9058 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 9059 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 9060 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 9061 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 9062 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
| 9063 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 9064 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 9065 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9066 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9067 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9068 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 9069 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9070 | */ |
| 9071 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9072 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9073 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9074 | }; |
| 9075 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9076 | static struct alc_config_preset alc882_presets[] = { |
| 9077 | [ALC882_3ST_DIG] = { |
| 9078 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9079 | .init_verbs = { alc882_base_init_verbs, |
| 9080 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9081 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9082 | .dac_nids = alc882_dac_nids, |
| 9083 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9084 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9085 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9086 | .channel_mode = alc882_ch_modes, |
| 9087 | .need_dac_fix = 1, |
| 9088 | .input_mux = &alc882_capture_source, |
| 9089 | }, |
| 9090 | [ALC882_6ST_DIG] = { |
| 9091 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9092 | .init_verbs = { alc882_base_init_verbs, |
| 9093 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9094 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9095 | .dac_nids = alc882_dac_nids, |
| 9096 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9097 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9098 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9099 | .channel_mode = alc882_sixstack_modes, |
| 9100 | .input_mux = &alc882_capture_source, |
| 9101 | }, |
| 9102 | [ALC882_ARIMA] = { |
| 9103 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9104 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9105 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9106 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9107 | .dac_nids = alc882_dac_nids, |
| 9108 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9109 | .channel_mode = alc882_sixstack_modes, |
| 9110 | .input_mux = &alc882_capture_source, |
| 9111 | }, |
| 9112 | [ALC882_W2JC] = { |
| 9113 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9114 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9115 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9116 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9117 | .dac_nids = alc882_dac_nids, |
| 9118 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9119 | .channel_mode = alc880_threestack_modes, |
| 9120 | .need_dac_fix = 1, |
| 9121 | .input_mux = &alc882_capture_source, |
| 9122 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9123 | }, |
| 9124 | [ALC885_MBP3] = { |
| 9125 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 9126 | .init_verbs = { alc885_mbp3_init_verbs, |
| 9127 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9128 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9129 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9130 | .hp_nid = 0x04, |
| 9131 | .channel_mode = alc885_mbp_4ch_modes, |
| 9132 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9133 | .input_mux = &alc882_capture_source, |
| 9134 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9135 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9136 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9137 | .setup = alc885_mbp3_setup, |
| 9138 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9139 | }, |
| 9140 | [ALC885_MB5] = { |
| 9141 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 9142 | .init_verbs = { alc885_mb5_init_verbs, |
| 9143 | alc880_gpio1_init_verbs }, |
| 9144 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9145 | .dac_nids = alc882_dac_nids, |
| 9146 | .channel_mode = alc885_mb5_6ch_modes, |
| 9147 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 9148 | .input_mux = &mb5_capture_source, |
| 9149 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9150 | .dig_in_nid = ALC882_DIGIN_NID, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame^] | 9151 | .unsol_event = alc885_mb5_unsol_event, |
| 9152 | .init_hook = alc885_mb5_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9153 | }, |
| 9154 | [ALC885_MACPRO] = { |
| 9155 | .mixers = { alc882_macpro_mixer }, |
| 9156 | .init_verbs = { alc882_macpro_init_verbs }, |
| 9157 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9158 | .dac_nids = alc882_dac_nids, |
| 9159 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9160 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9161 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9162 | .channel_mode = alc882_ch_modes, |
| 9163 | .input_mux = &alc882_capture_source, |
| 9164 | .init_hook = alc885_macpro_init_hook, |
| 9165 | }, |
| 9166 | [ALC885_IMAC24] = { |
| 9167 | .mixers = { alc885_imac24_mixer }, |
| 9168 | .init_verbs = { alc885_imac24_init_verbs }, |
| 9169 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9170 | .dac_nids = alc882_dac_nids, |
| 9171 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9172 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9173 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9174 | .channel_mode = alc882_ch_modes, |
| 9175 | .input_mux = &alc882_capture_source, |
| 9176 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9177 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9178 | .init_hook = alc885_imac24_init_hook, |
| 9179 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9180 | [ALC885_IMAC91] = { |
| 9181 | .mixers = { alc885_imac91_mixer, alc882_chmode_mixer }, |
| 9182 | .init_verbs = { alc885_imac91_init_verbs, |
| 9183 | alc880_gpio1_init_verbs }, |
| 9184 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9185 | .dac_nids = alc882_dac_nids, |
| 9186 | .channel_mode = alc885_mbp_4ch_modes, |
| 9187 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
| 9188 | .input_mux = &alc882_capture_source, |
| 9189 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9190 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9191 | .unsol_event = alc885_imac91_unsol_event, |
| 9192 | .init_hook = alc885_imac91_automute, |
| 9193 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9194 | [ALC882_TARGA] = { |
| 9195 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9196 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 9197 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9198 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9199 | .dac_nids = alc882_dac_nids, |
| 9200 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9201 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9202 | .adc_nids = alc882_adc_nids, |
| 9203 | .capsrc_nids = alc882_capsrc_nids, |
| 9204 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9205 | .channel_mode = alc882_3ST_6ch_modes, |
| 9206 | .need_dac_fix = 1, |
| 9207 | .input_mux = &alc882_capture_source, |
| 9208 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9209 | .setup = alc882_targa_setup, |
| 9210 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9211 | }, |
| 9212 | [ALC882_ASUS_A7J] = { |
| 9213 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9214 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9215 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9216 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9217 | .dac_nids = alc882_dac_nids, |
| 9218 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9219 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9220 | .adc_nids = alc882_adc_nids, |
| 9221 | .capsrc_nids = alc882_capsrc_nids, |
| 9222 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9223 | .channel_mode = alc882_3ST_6ch_modes, |
| 9224 | .need_dac_fix = 1, |
| 9225 | .input_mux = &alc882_capture_source, |
| 9226 | }, |
| 9227 | [ALC882_ASUS_A7M] = { |
| 9228 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9229 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9230 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9231 | alc882_asus_a7m_verbs }, |
| 9232 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9233 | .dac_nids = alc882_dac_nids, |
| 9234 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9235 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9236 | .channel_mode = alc880_threestack_modes, |
| 9237 | .need_dac_fix = 1, |
| 9238 | .input_mux = &alc882_capture_source, |
| 9239 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9240 | [ALC883_3ST_2ch_DIG] = { |
| 9241 | .mixers = { alc883_3ST_2ch_mixer }, |
| 9242 | .init_verbs = { alc883_init_verbs }, |
| 9243 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9244 | .dac_nids = alc883_dac_nids, |
| 9245 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9246 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9247 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9248 | .channel_mode = alc883_3ST_2ch_modes, |
| 9249 | .input_mux = &alc883_capture_source, |
| 9250 | }, |
| 9251 | [ALC883_3ST_6ch_DIG] = { |
| 9252 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9253 | .init_verbs = { alc883_init_verbs }, |
| 9254 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9255 | .dac_nids = alc883_dac_nids, |
| 9256 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9257 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9258 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9259 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9260 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9261 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9262 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9263 | [ALC883_3ST_6ch] = { |
| 9264 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9265 | .init_verbs = { alc883_init_verbs }, |
| 9266 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9267 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9268 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9269 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9270 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9271 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9272 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9273 | [ALC883_3ST_6ch_INTEL] = { |
| 9274 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 9275 | .init_verbs = { alc883_init_verbs }, |
| 9276 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9277 | .dac_nids = alc883_dac_nids, |
| 9278 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9279 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9280 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9281 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 9282 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 9283 | .need_dac_fix = 1, |
| 9284 | .input_mux = &alc883_3stack_6ch_intel, |
| 9285 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9286 | [ALC889A_INTEL] = { |
| 9287 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9288 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 9289 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9290 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9291 | .dac_nids = alc883_dac_nids, |
| 9292 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9293 | .adc_nids = alc889_adc_nids, |
| 9294 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9295 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9296 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9297 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9298 | .channel_mode = alc889_8ch_intel_modes, |
| 9299 | .capsrc_nids = alc889_capsrc_nids, |
| 9300 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9301 | .setup = alc889_automute_setup, |
| 9302 | .init_hook = alc_automute_amp, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9303 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9304 | .need_dac_fix = 1, |
| 9305 | }, |
| 9306 | [ALC889_INTEL] = { |
| 9307 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 9308 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9309 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9310 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9311 | .dac_nids = alc883_dac_nids, |
| 9312 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9313 | .adc_nids = alc889_adc_nids, |
| 9314 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9315 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9316 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9317 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9318 | .channel_mode = alc889_8ch_intel_modes, |
| 9319 | .capsrc_nids = alc889_capsrc_nids, |
| 9320 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9321 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9322 | .init_hook = alc889_intel_init_hook, |
| 9323 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9324 | .need_dac_fix = 1, |
| 9325 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9326 | [ALC883_6ST_DIG] = { |
| 9327 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9328 | .init_verbs = { alc883_init_verbs }, |
| 9329 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9330 | .dac_nids = alc883_dac_nids, |
| 9331 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9332 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9333 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9334 | .channel_mode = alc883_sixstack_modes, |
| 9335 | .input_mux = &alc883_capture_source, |
| 9336 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9337 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9338 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9339 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9340 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9341 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9342 | .dac_nids = alc883_dac_nids, |
| 9343 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9344 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9345 | .channel_mode = alc883_3ST_6ch_modes, |
| 9346 | .need_dac_fix = 1, |
| 9347 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9348 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9349 | .setup = alc882_targa_setup, |
| 9350 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9351 | }, |
| 9352 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9353 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9354 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9355 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9356 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9357 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9358 | .adc_nids = alc883_adc_nids_alt, |
| 9359 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 9360 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9361 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9362 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9363 | .channel_mode = alc883_3ST_2ch_modes, |
| 9364 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9365 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9366 | .setup = alc882_targa_setup, |
| 9367 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9368 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9369 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9370 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 9371 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9372 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9373 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9374 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9375 | .dac_nids = alc883_dac_nids, |
| 9376 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9377 | .adc_nids = alc883_adc_nids_rev, |
| 9378 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9379 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9380 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9381 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 9382 | .channel_mode = alc883_4ST_8ch_modes, |
| 9383 | .need_dac_fix = 1, |
| 9384 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9385 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9386 | .setup = alc882_targa_setup, |
| 9387 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9388 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9389 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9390 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9391 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 9392 | * and the headphone jack. Turn this on and rely on the |
| 9393 | * standard mute methods whenever the user wants to turn |
| 9394 | * these outputs off. |
| 9395 | */ |
| 9396 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 9397 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9398 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9399 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9400 | .channel_mode = alc883_3ST_2ch_modes, |
| 9401 | .input_mux = &alc883_capture_source, |
| 9402 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9403 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9404 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9405 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9406 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9407 | .dac_nids = alc883_dac_nids, |
| 9408 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9409 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9410 | .channel_mode = alc883_3ST_2ch_modes, |
| 9411 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9412 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9413 | .setup = alc883_acer_aspire_setup, |
| 9414 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9415 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9416 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9417 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9418 | alc883_chmode_mixer }, |
| 9419 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9420 | alc888_acer_aspire_4930g_verbs }, |
| 9421 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9422 | .dac_nids = alc883_dac_nids, |
| 9423 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9424 | .adc_nids = alc883_adc_nids_rev, |
| 9425 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9426 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9427 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9428 | .channel_mode = alc883_3ST_6ch_modes, |
| 9429 | .need_dac_fix = 1, |
| 9430 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9431 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9432 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9433 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9434 | .setup = alc888_acer_aspire_4930g_setup, |
| 9435 | .init_hook = alc_automute_amp, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9436 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9437 | [ALC888_ACER_ASPIRE_6530G] = { |
| 9438 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 9439 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9440 | alc888_acer_aspire_6530g_verbs }, |
| 9441 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9442 | .dac_nids = alc883_dac_nids, |
| 9443 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9444 | .adc_nids = alc883_adc_nids_rev, |
| 9445 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9446 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9447 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9448 | .channel_mode = alc883_3ST_2ch_modes, |
| 9449 | .num_mux_defs = |
| 9450 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9451 | .input_mux = alc888_acer_aspire_6530_sources, |
| 9452 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9453 | .setup = alc888_acer_aspire_6530g_setup, |
| 9454 | .init_hook = alc_automute_amp, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9455 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9456 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 9457 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9458 | alc883_chmode_mixer }, |
| 9459 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 9460 | alc889_acer_aspire_8930g_verbs, |
| 9461 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9462 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9463 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9464 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9465 | .adc_nids = alc889_adc_nids, |
| 9466 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9467 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9468 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9469 | .channel_mode = alc883_3ST_6ch_modes, |
| 9470 | .need_dac_fix = 1, |
| 9471 | .const_channel_count = 6, |
| 9472 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9473 | ARRAY_SIZE(alc889_capture_sources), |
| 9474 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9475 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9476 | .setup = alc889_acer_aspire_8930g_setup, |
| 9477 | .init_hook = alc_automute_amp, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 9478 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9479 | .power_hook = alc889_power_eapd, |
| 9480 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9481 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9482 | [ALC888_ACER_ASPIRE_7730G] = { |
| 9483 | .mixers = { alc883_3ST_6ch_mixer, |
| 9484 | alc883_chmode_mixer }, |
| 9485 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9486 | alc888_acer_aspire_7730G_verbs }, |
| 9487 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9488 | .dac_nids = alc883_dac_nids, |
| 9489 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9490 | .adc_nids = alc883_adc_nids_rev, |
| 9491 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9492 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9493 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9494 | .channel_mode = alc883_3ST_6ch_modes, |
| 9495 | .need_dac_fix = 1, |
| 9496 | .const_channel_count = 6, |
| 9497 | .input_mux = &alc883_capture_source, |
| 9498 | .unsol_event = alc_automute_amp_unsol_event, |
| 9499 | .setup = alc888_acer_aspire_6530g_setup, |
| 9500 | .init_hook = alc_automute_amp, |
| 9501 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9502 | [ALC883_MEDION] = { |
| 9503 | .mixers = { alc883_fivestack_mixer, |
| 9504 | alc883_chmode_mixer }, |
| 9505 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9506 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9507 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9508 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9509 | .adc_nids = alc883_adc_nids_alt, |
| 9510 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 9511 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9512 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9513 | .channel_mode = alc883_sixstack_modes, |
| 9514 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9515 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9516 | [ALC883_MEDION_MD2] = { |
| 9517 | .mixers = { alc883_medion_md2_mixer}, |
| 9518 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 9519 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9520 | .dac_nids = alc883_dac_nids, |
| 9521 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9522 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9523 | .channel_mode = alc883_3ST_2ch_modes, |
| 9524 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9525 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9526 | .setup = alc883_medion_md2_setup, |
| 9527 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9528 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9529 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9530 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9531 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 9532 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9533 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9534 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9535 | .channel_mode = alc883_3ST_2ch_modes, |
| 9536 | .input_mux = &alc883_capture_source, |
| 9537 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9538 | [ALC883_CLEVO_M540R] = { |
| 9539 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9540 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 9541 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9542 | .dac_nids = alc883_dac_nids, |
| 9543 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9544 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9545 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 9546 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 9547 | .need_dac_fix = 1, |
| 9548 | .input_mux = &alc883_capture_source, |
| 9549 | /* This machine has the hardware HP auto-muting, thus |
| 9550 | * we need no software mute via unsol event |
| 9551 | */ |
| 9552 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9553 | [ALC883_CLEVO_M720] = { |
| 9554 | .mixers = { alc883_clevo_m720_mixer }, |
| 9555 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9556 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9557 | .dac_nids = alc883_dac_nids, |
| 9558 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9559 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9560 | .channel_mode = alc883_3ST_2ch_modes, |
| 9561 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9562 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9563 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9564 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9565 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9566 | [ALC883_LENOVO_101E_2ch] = { |
| 9567 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 9568 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 9569 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9570 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9571 | .adc_nids = alc883_adc_nids_alt, |
| 9572 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 9573 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9574 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9575 | .channel_mode = alc883_3ST_2ch_modes, |
| 9576 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 9577 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 9578 | .init_hook = alc883_lenovo_101e_all_automute, |
| 9579 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9580 | [ALC883_LENOVO_NB0763] = { |
| 9581 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 9582 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 9583 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9584 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9585 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9586 | .channel_mode = alc883_3ST_2ch_modes, |
| 9587 | .need_dac_fix = 1, |
| 9588 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9589 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9590 | .setup = alc883_medion_md2_setup, |
| 9591 | .init_hook = alc_automute_amp, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9592 | }, |
| 9593 | [ALC888_LENOVO_MS7195_DIG] = { |
| 9594 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9595 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 9596 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9597 | .dac_nids = alc883_dac_nids, |
| 9598 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9599 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9600 | .channel_mode = alc883_3ST_6ch_modes, |
| 9601 | .need_dac_fix = 1, |
| 9602 | .input_mux = &alc883_capture_source, |
| 9603 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 9604 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9605 | }, |
| 9606 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9607 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9608 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 9609 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9610 | .dac_nids = alc883_dac_nids, |
| 9611 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9612 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9613 | .channel_mode = alc883_3ST_2ch_modes, |
| 9614 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9615 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9616 | .setup = alc883_haier_w66_setup, |
| 9617 | .init_hook = alc_automute_amp, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9618 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9619 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9620 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9621 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9622 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9623 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9624 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 9625 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9626 | .need_dac_fix = 1, |
| 9627 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9628 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9629 | .setup = alc888_3st_hp_setup, |
| 9630 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9631 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9632 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 9633 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9634 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 9635 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9636 | .dac_nids = alc883_dac_nids, |
| 9637 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9638 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9639 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9640 | .channel_mode = alc883_sixstack_modes, |
| 9641 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9642 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9643 | .setup = alc888_6st_dell_setup, |
| 9644 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9645 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9646 | [ALC883_MITAC] = { |
| 9647 | .mixers = { alc883_mitac_mixer }, |
| 9648 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 9649 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9650 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9651 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9652 | .channel_mode = alc883_3ST_2ch_modes, |
| 9653 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9654 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9655 | .setup = alc883_mitac_setup, |
| 9656 | .init_hook = alc_automute_amp, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9657 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9658 | [ALC883_FUJITSU_PI2515] = { |
| 9659 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 9660 | .init_verbs = { alc883_init_verbs, |
| 9661 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 9662 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9663 | .dac_nids = alc883_dac_nids, |
| 9664 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9665 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9666 | .channel_mode = alc883_3ST_2ch_modes, |
| 9667 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9668 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9669 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
| 9670 | .init_hook = alc_automute_amp, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9671 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9672 | [ALC888_FUJITSU_XA3530] = { |
| 9673 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 9674 | .init_verbs = { alc883_init_verbs, |
| 9675 | alc888_fujitsu_xa3530_verbs }, |
| 9676 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9677 | .dac_nids = alc883_dac_nids, |
| 9678 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9679 | .adc_nids = alc883_adc_nids_rev, |
| 9680 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9681 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9682 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 9683 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 9684 | .num_mux_defs = |
| 9685 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9686 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9687 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9688 | .setup = alc888_fujitsu_xa3530_setup, |
| 9689 | .init_hook = alc_automute_amp, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9690 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9691 | [ALC888_LENOVO_SKY] = { |
| 9692 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 9693 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 9694 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9695 | .dac_nids = alc883_dac_nids, |
| 9696 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9697 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9698 | .channel_mode = alc883_sixstack_modes, |
| 9699 | .need_dac_fix = 1, |
| 9700 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9701 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9702 | .setup = alc888_lenovo_sky_setup, |
| 9703 | .init_hook = alc_automute_amp, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9704 | }, |
| 9705 | [ALC888_ASUS_M90V] = { |
| 9706 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9707 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 9708 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9709 | .dac_nids = alc883_dac_nids, |
| 9710 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9711 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9712 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9713 | .channel_mode = alc883_3ST_6ch_modes, |
| 9714 | .need_dac_fix = 1, |
| 9715 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9716 | .unsol_event = alc_sku_unsol_event, |
| 9717 | .setup = alc883_mode2_setup, |
| 9718 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9719 | }, |
| 9720 | [ALC888_ASUS_EEE1601] = { |
| 9721 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9722 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9723 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 9724 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9725 | .dac_nids = alc883_dac_nids, |
| 9726 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9727 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9728 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9729 | .channel_mode = alc883_3ST_2ch_modes, |
| 9730 | .need_dac_fix = 1, |
| 9731 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9732 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9733 | .init_hook = alc883_eee1601_inithook, |
| 9734 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9735 | [ALC1200_ASUS_P5Q] = { |
| 9736 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9737 | .init_verbs = { alc883_init_verbs }, |
| 9738 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9739 | .dac_nids = alc883_dac_nids, |
| 9740 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 9741 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 9742 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9743 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9744 | .channel_mode = alc883_sixstack_modes, |
| 9745 | .input_mux = &alc883_capture_source, |
| 9746 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9747 | [ALC889A_MB31] = { |
| 9748 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 9749 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 9750 | alc880_gpio1_init_verbs }, |
| 9751 | .adc_nids = alc883_adc_nids, |
| 9752 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 9753 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9754 | .dac_nids = alc883_dac_nids, |
| 9755 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9756 | .channel_mode = alc889A_mb31_6ch_modes, |
| 9757 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 9758 | .input_mux = &alc889A_mb31_capture_source, |
| 9759 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9760 | .unsol_event = alc889A_mb31_unsol_event, |
| 9761 | .init_hook = alc889A_mb31_automute, |
| 9762 | }, |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9763 | [ALC883_SONY_VAIO_TT] = { |
| 9764 | .mixers = { alc883_vaiott_mixer }, |
| 9765 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 9766 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9767 | .dac_nids = alc883_dac_nids, |
| 9768 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9769 | .channel_mode = alc883_3ST_2ch_modes, |
| 9770 | .input_mux = &alc883_capture_source, |
| 9771 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9772 | .setup = alc883_vaiott_setup, |
| 9773 | .init_hook = alc_automute_amp, |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9774 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9775 | }; |
| 9776 | |
| 9777 | |
| 9778 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9779 | * Pin config fixes |
| 9780 | */ |
| 9781 | enum { |
| 9782 | PINFIX_ABIT_AW9D_MAX |
| 9783 | }; |
| 9784 | |
| 9785 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 9786 | { 0x15, 0x01080104 }, /* side */ |
| 9787 | { 0x16, 0x01011012 }, /* rear */ |
| 9788 | { 0x17, 0x01016011 }, /* clfe */ |
| 9789 | { } |
| 9790 | }; |
| 9791 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 9792 | static const struct alc_fixup alc882_fixups[] = { |
| 9793 | [PINFIX_ABIT_AW9D_MAX] = { |
| 9794 | .pins = alc882_abit_aw9d_pinfix |
| 9795 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9796 | }; |
| 9797 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 9798 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9799 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 9800 | {} |
| 9801 | }; |
| 9802 | |
| 9803 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9804 | * BIOS auto configuration |
| 9805 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9806 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 9807 | const struct auto_pin_cfg *cfg) |
| 9808 | { |
| 9809 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 9810 | } |
| 9811 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9812 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9813 | hda_nid_t nid, int pin_type, |
| 9814 | int dac_idx) |
| 9815 | { |
| 9816 | /* set as output */ |
| 9817 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9818 | int idx; |
| 9819 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9820 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9821 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 9822 | idx = 4; |
| 9823 | else |
| 9824 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9825 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 9826 | |
| 9827 | } |
| 9828 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9829 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9830 | { |
| 9831 | struct alc_spec *spec = codec->spec; |
| 9832 | int i; |
| 9833 | |
| 9834 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9835 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9836 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9837 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9838 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9839 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9840 | } |
| 9841 | } |
| 9842 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9843 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9844 | { |
| 9845 | struct alc_spec *spec = codec->spec; |
| 9846 | hda_nid_t pin; |
| 9847 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9848 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9849 | if (pin) /* connect to front */ |
| 9850 | /* use dac 0 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9851 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9852 | pin = spec->autocfg.speaker_pins[0]; |
| 9853 | if (pin) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9854 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9855 | } |
| 9856 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9857 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9858 | { |
| 9859 | struct alc_spec *spec = codec->spec; |
| 9860 | int i; |
| 9861 | |
| 9862 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9863 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9864 | if (!nid) |
| 9865 | continue; |
Takashi Iwai | 0d971c9 | 2009-06-30 16:11:11 +0200 | [diff] [blame] | 9866 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9867 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 9868 | snd_hda_codec_write(codec, nid, 0, |
| 9869 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9870 | AMP_OUT_MUTE); |
| 9871 | } |
| 9872 | } |
| 9873 | |
| 9874 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 9875 | { |
| 9876 | struct alc_spec *spec = codec->spec; |
| 9877 | int c; |
| 9878 | |
| 9879 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 9880 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 9881 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 9882 | unsigned int mux_idx; |
| 9883 | const struct hda_input_mux *imux; |
| 9884 | int conns, mute, idx, item; |
| 9885 | |
| 9886 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 9887 | ARRAY_SIZE(conn_list)); |
| 9888 | if (conns < 0) |
| 9889 | continue; |
| 9890 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 9891 | imux = &spec->input_mux[mux_idx]; |
| 9892 | for (idx = 0; idx < conns; idx++) { |
| 9893 | /* if the current connection is the selected one, |
| 9894 | * unmute it as default - otherwise mute it |
| 9895 | */ |
| 9896 | mute = AMP_IN_MUTE(idx); |
| 9897 | for (item = 0; item < imux->num_items; item++) { |
| 9898 | if (imux->items[item].index == idx) { |
| 9899 | if (spec->cur_mux[c] == item) |
| 9900 | mute = AMP_IN_UNMUTE(idx); |
| 9901 | break; |
| 9902 | } |
| 9903 | } |
| 9904 | /* check if we have a selector or mixer |
| 9905 | * we could check for the widget type instead, but |
| 9906 | * just check for Amp-In presence (in case of mixer |
| 9907 | * without amp-in there is something wrong, this |
| 9908 | * function shouldn't be used or capsrc nid is wrong) |
| 9909 | */ |
| 9910 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9911 | snd_hda_codec_write(codec, nid, 0, |
| 9912 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9913 | mute); |
| 9914 | else if (mute != AMP_IN_MUTE(idx)) |
| 9915 | snd_hda_codec_write(codec, nid, 0, |
| 9916 | AC_VERB_SET_CONNECT_SEL, |
| 9917 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9918 | } |
| 9919 | } |
| 9920 | } |
| 9921 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9922 | /* add mic boosts if needed */ |
| 9923 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9924 | { |
| 9925 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9926 | int err; |
| 9927 | hda_nid_t nid; |
| 9928 | |
| 9929 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 9930 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 9931 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9932 | "Mic Boost", |
| 9933 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9934 | if (err < 0) |
| 9935 | return err; |
| 9936 | } |
| 9937 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 9938 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 9939 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9940 | "Front Mic Boost", |
| 9941 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9942 | if (err < 0) |
| 9943 | return err; |
| 9944 | } |
| 9945 | return 0; |
| 9946 | } |
| 9947 | |
| 9948 | /* almost identical with ALC880 parser... */ |
| 9949 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 9950 | { |
| 9951 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9952 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
| 9953 | int i, err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9954 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9955 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9956 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9957 | if (err < 0) |
| 9958 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9959 | if (!spec->autocfg.line_outs) |
| 9960 | return 0; /* can't find valid BIOS pin config */ |
| 9961 | |
| 9962 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 9963 | if (err < 0) |
| 9964 | return err; |
| 9965 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9966 | if (err < 0) |
| 9967 | return err; |
| 9968 | err = alc880_auto_create_extra_out(spec, |
| 9969 | spec->autocfg.speaker_pins[0], |
| 9970 | "Speaker"); |
| 9971 | if (err < 0) |
| 9972 | return err; |
| 9973 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 9974 | "Headphone"); |
| 9975 | if (err < 0) |
| 9976 | return err; |
| 9977 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 9978 | if (err < 0) |
| 9979 | return err; |
| 9980 | |
| 9981 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 9982 | |
| 9983 | /* check multiple SPDIF-out (for recent codecs) */ |
| 9984 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 9985 | hda_nid_t dig_nid; |
| 9986 | err = snd_hda_get_connections(codec, |
| 9987 | spec->autocfg.dig_out_pins[i], |
| 9988 | &dig_nid, 1); |
| 9989 | if (err < 0) |
| 9990 | continue; |
| 9991 | if (!i) |
| 9992 | spec->multiout.dig_out_nid = dig_nid; |
| 9993 | else { |
| 9994 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 9995 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9996 | break; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 9997 | spec->slave_dig_outs[i - 1] = dig_nid; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9998 | } |
| 9999 | } |
| 10000 | if (spec->autocfg.dig_in_pin) |
| 10001 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 10002 | |
| 10003 | if (spec->kctls.list) |
| 10004 | add_mixer(spec, spec->kctls.list); |
| 10005 | |
| 10006 | add_verb(spec, alc883_auto_init_verbs); |
| 10007 | /* if ADC 0x07 is available, initialize it, too */ |
| 10008 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 10009 | add_verb(spec, alc882_adc1_init_verbs); |
| 10010 | |
| 10011 | spec->num_mux_defs = 1; |
| 10012 | spec->input_mux = &spec->private_imux[0]; |
| 10013 | |
| 10014 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10015 | |
| 10016 | err = alc_auto_add_mic_boost(codec); |
| 10017 | if (err < 0) |
| 10018 | return err; |
| 10019 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10020 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10021 | } |
| 10022 | |
| 10023 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10024 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10025 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10026 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10027 | alc882_auto_init_multi_out(codec); |
| 10028 | alc882_auto_init_hp_out(codec); |
| 10029 | alc882_auto_init_analog_input(codec); |
| 10030 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10031 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10032 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10033 | } |
| 10034 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10035 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10036 | { |
| 10037 | struct alc_spec *spec; |
| 10038 | int err, board_config; |
| 10039 | |
| 10040 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10041 | if (spec == NULL) |
| 10042 | return -ENOMEM; |
| 10043 | |
| 10044 | codec->spec = spec; |
| 10045 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10046 | switch (codec->vendor_id) { |
| 10047 | case 0x10ec0882: |
| 10048 | case 0x10ec0885: |
| 10049 | break; |
| 10050 | default: |
| 10051 | /* ALC883 and variants */ |
| 10052 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10053 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10054 | } |
| 10055 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10056 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 10057 | alc882_models, |
| 10058 | alc882_cfg_tbl); |
| 10059 | |
| 10060 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 10061 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 10062 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 10063 | |
| 10064 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 10065 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10066 | codec->chip_name); |
| 10067 | board_config = ALC882_AUTO; |
| 10068 | } |
| 10069 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10070 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10071 | |
| 10072 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10073 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10074 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10075 | if (err < 0) { |
| 10076 | alc_free(codec); |
| 10077 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10078 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10079 | printk(KERN_INFO |
| 10080 | "hda_codec: Cannot set up configuration " |
| 10081 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10082 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10083 | } |
| 10084 | } |
| 10085 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 10086 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 10087 | if (err < 0) { |
| 10088 | alc_free(codec); |
| 10089 | return err; |
| 10090 | } |
| 10091 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10092 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 10093 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10094 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10095 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 10096 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 10097 | /* FIXME: setup DAC5 */ |
| 10098 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 10099 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 10100 | |
| 10101 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 10102 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 10103 | |
| 10104 | if (codec->vendor_id == 0x10ec0888) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 10105 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10106 | |
| 10107 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10108 | int i, j; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10109 | spec->num_adc_nids = 0; |
| 10110 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10111 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10112 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10113 | hda_nid_t items[16]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10114 | hda_nid_t nid = alc882_adc_nids[i]; |
| 10115 | unsigned int wcap = get_wcaps(codec, nid); |
| 10116 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 10117 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10118 | if (wcap != AC_WID_AUD_IN) |
| 10119 | continue; |
| 10120 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 10121 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 10122 | if (err < 0) |
| 10123 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10124 | err = snd_hda_get_connections(codec, cap, items, |
| 10125 | ARRAY_SIZE(items)); |
| 10126 | if (err < 0) |
| 10127 | continue; |
| 10128 | for (j = 0; j < imux->num_items; j++) |
| 10129 | if (imux->items[j].index >= err) |
| 10130 | break; |
| 10131 | if (j < imux->num_items) |
| 10132 | continue; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10133 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 10134 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 10135 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10136 | spec->adc_nids = spec->private_adc_nids; |
| 10137 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 10138 | } |
| 10139 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 10140 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 10141 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10142 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10143 | spec->vmaster_nid = 0x0c; |
| 10144 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10145 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10146 | if (board_config == ALC882_AUTO) |
| 10147 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10148 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10149 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10150 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10151 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 10152 | codec->proc_widget_hook = print_realtek_coef; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10153 | |
| 10154 | return 0; |
| 10155 | } |
| 10156 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10157 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10158 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10159 | * ALC262 support |
| 10160 | */ |
| 10161 | |
| 10162 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 10163 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 10164 | |
| 10165 | #define alc262_dac_nids alc260_dac_nids |
| 10166 | #define alc262_adc_nids alc882_adc_nids |
| 10167 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10168 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 10169 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10170 | |
| 10171 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 10172 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10173 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10174 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 10175 | /* ADC0 */ |
| 10176 | 0x09 |
| 10177 | }; |
| 10178 | |
| 10179 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 10180 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10181 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 10182 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10183 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10184 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10185 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10186 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10187 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10188 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10189 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10190 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10191 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10192 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10193 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10194 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 10195 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10196 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 10197 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10198 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10199 | }; |
| 10200 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10201 | /* update HP, line and mono-out pins according to the master switch */ |
| 10202 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 10203 | { |
| 10204 | struct alc_spec *spec = codec->spec; |
| 10205 | int val = spec->master_sw; |
| 10206 | |
| 10207 | /* HP & line-out */ |
| 10208 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 10209 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10210 | val ? PIN_HP : 0); |
| 10211 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10212 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10213 | val ? PIN_HP : 0); |
| 10214 | /* mono (speaker) depending on the HP jack sense */ |
| 10215 | val = val && !spec->jack_present; |
| 10216 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 10217 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10218 | val ? PIN_OUT : 0); |
| 10219 | } |
| 10220 | |
| 10221 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 10222 | { |
| 10223 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10224 | |
| 10225 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10226 | alc262_hp_master_update(codec); |
| 10227 | } |
| 10228 | |
| 10229 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10230 | { |
| 10231 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10232 | return; |
| 10233 | alc262_hp_bpc_automute(codec); |
| 10234 | } |
| 10235 | |
| 10236 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 10237 | { |
| 10238 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10239 | |
| 10240 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10241 | alc262_hp_master_update(codec); |
| 10242 | } |
| 10243 | |
| 10244 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 10245 | unsigned int res) |
| 10246 | { |
| 10247 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10248 | return; |
| 10249 | alc262_hp_wildwest_automute(codec); |
| 10250 | } |
| 10251 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10252 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10253 | |
| 10254 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10255 | struct snd_ctl_elem_value *ucontrol) |
| 10256 | { |
| 10257 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10258 | struct alc_spec *spec = codec->spec; |
| 10259 | int val = !!*ucontrol->value.integer.value; |
| 10260 | |
| 10261 | if (val == spec->master_sw) |
| 10262 | return 0; |
| 10263 | spec->master_sw = val; |
| 10264 | alc262_hp_master_update(codec); |
| 10265 | return 1; |
| 10266 | } |
| 10267 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10268 | #define ALC262_HP_MASTER_SWITCH \ |
| 10269 | { \ |
| 10270 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10271 | .name = "Master Playback Switch", \ |
| 10272 | .info = snd_ctl_boolean_mono_info, \ |
| 10273 | .get = alc262_hp_master_sw_get, \ |
| 10274 | .put = alc262_hp_master_sw_put, \ |
| 10275 | } |
| 10276 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10277 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10278 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10279 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10280 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10281 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10282 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10283 | HDA_OUTPUT), |
| 10284 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10285 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10286 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10287 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10288 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10289 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10290 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10291 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10292 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10293 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10294 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10295 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10296 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10297 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10298 | { } /* end */ |
| 10299 | }; |
| 10300 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10301 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10302 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10303 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10304 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10305 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10306 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10307 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10308 | HDA_OUTPUT), |
| 10309 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10310 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10311 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10312 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10313 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10314 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10315 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10316 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10317 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10318 | { } /* end */ |
| 10319 | }; |
| 10320 | |
| 10321 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 10322 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10323 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10324 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10325 | { } /* end */ |
| 10326 | }; |
| 10327 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10328 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10329 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10330 | { |
| 10331 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10332 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10333 | spec->autocfg.hp_pins[0] = 0x15; |
| 10334 | spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10335 | } |
| 10336 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10337 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10338 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10339 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10340 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10341 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10342 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10343 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10344 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10345 | { } /* end */ |
| 10346 | }; |
| 10347 | |
| 10348 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 10349 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10350 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10351 | |
| 10352 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10353 | { } |
| 10354 | }; |
| 10355 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10356 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 10357 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10358 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10359 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 10360 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10361 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10362 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10363 | { } /* end */ |
| 10364 | }; |
| 10365 | |
| 10366 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 10367 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10368 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10369 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10370 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10371 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10372 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10373 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10374 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10375 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10376 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10377 | {} |
| 10378 | }; |
| 10379 | |
| 10380 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 10381 | .num_items = 1, |
| 10382 | .items = { |
| 10383 | { "Line", 0x1 }, |
| 10384 | }, |
| 10385 | }; |
| 10386 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10387 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 10388 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 10389 | { |
| 10390 | struct alc_spec *spec = codec->spec; |
| 10391 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10392 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10393 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10394 | unsigned int mute; |
| 10395 | |
| 10396 | /* HP */ |
| 10397 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 10398 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 10399 | HDA_AMP_MUTE, mute); |
| 10400 | /* mute internal speaker per jack sense */ |
| 10401 | if (spec->jack_present) |
| 10402 | mute = HDA_AMP_MUTE; |
| 10403 | if (line_nid) |
| 10404 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 10405 | HDA_AMP_MUTE, mute); |
| 10406 | if (speaker_nid && speaker_nid != line_nid) |
| 10407 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 10408 | HDA_AMP_MUTE, mute); |
| 10409 | } |
| 10410 | |
| 10411 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 10412 | |
| 10413 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10414 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10415 | { |
| 10416 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10417 | struct alc_spec *spec = codec->spec; |
| 10418 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10419 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10420 | if (val == spec->master_sw) |
| 10421 | return 0; |
| 10422 | spec->master_sw = val; |
| 10423 | alc262_hippo_master_update(codec); |
| 10424 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10425 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10426 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10427 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 10428 | { \ |
| 10429 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10430 | .name = "Master Playback Switch", \ |
| 10431 | .info = snd_ctl_boolean_mono_info, \ |
| 10432 | .get = alc262_hippo_master_sw_get, \ |
| 10433 | .put = alc262_hippo_master_sw_put, \ |
| 10434 | } |
| 10435 | |
| 10436 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 10437 | ALC262_HIPPO_MASTER_SWITCH, |
| 10438 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10439 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10440 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10441 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10442 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10443 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10444 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10445 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10446 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10447 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10448 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10449 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10450 | { } /* end */ |
| 10451 | }; |
| 10452 | |
| 10453 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 10454 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10455 | ALC262_HIPPO_MASTER_SWITCH, |
| 10456 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10457 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10458 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10459 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10460 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10461 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10462 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10463 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10464 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10465 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10466 | { } /* end */ |
| 10467 | }; |
| 10468 | |
| 10469 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10470 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 10471 | { |
| 10472 | struct alc_spec *spec = codec->spec; |
| 10473 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10474 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10475 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10476 | alc262_hippo_master_update(codec); |
| 10477 | } |
| 10478 | |
| 10479 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10480 | { |
| 10481 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10482 | return; |
| 10483 | alc262_hippo_automute(codec); |
| 10484 | } |
| 10485 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10486 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10487 | { |
| 10488 | struct alc_spec *spec = codec->spec; |
| 10489 | |
| 10490 | spec->autocfg.hp_pins[0] = 0x15; |
| 10491 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10492 | } |
| 10493 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10494 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10495 | { |
| 10496 | struct alc_spec *spec = codec->spec; |
| 10497 | |
| 10498 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10499 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10500 | } |
| 10501 | |
| 10502 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10503 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10504 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10505 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10506 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10507 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10508 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10509 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10510 | { } /* end */ |
| 10511 | }; |
| 10512 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10513 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10514 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10515 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10516 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10517 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10518 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10519 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10520 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10521 | { } /* end */ |
| 10522 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10523 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10524 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 10525 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10526 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 10527 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10528 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10529 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10530 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10531 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10532 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10533 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10534 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10535 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10536 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10537 | { } /* end */ |
| 10538 | }; |
| 10539 | |
| 10540 | static struct hda_verb alc262_tyan_verbs[] = { |
| 10541 | /* Headphone automute */ |
| 10542 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10543 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10544 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10545 | |
| 10546 | /* P11 AUX_IN, white 4-pin connector */ |
| 10547 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10548 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 10549 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 10550 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 10551 | |
| 10552 | {} |
| 10553 | }; |
| 10554 | |
| 10555 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10556 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10557 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10558 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10559 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10560 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10561 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10562 | } |
| 10563 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10564 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10565 | #define alc262_capture_mixer alc882_capture_mixer |
| 10566 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 10567 | |
| 10568 | /* |
| 10569 | * generic initialization of ADC, input mixers and output mixers |
| 10570 | */ |
| 10571 | static struct hda_verb alc262_init_verbs[] = { |
| 10572 | /* |
| 10573 | * Unmute ADC0-2 and set the default input to mic-in |
| 10574 | */ |
| 10575 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10576 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10577 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10578 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10579 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10580 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10581 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10582 | /* 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] | 10583 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10584 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10585 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10586 | */ |
| 10587 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10588 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10589 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10590 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10591 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10592 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10593 | |
| 10594 | /* |
| 10595 | * Set up output mixers (0x0c - 0x0e) |
| 10596 | */ |
| 10597 | /* set vol=0 to output mixers */ |
| 10598 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10599 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10600 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10601 | /* set up input amps for analog loopback */ |
| 10602 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10603 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10604 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10605 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10606 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10607 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10608 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10609 | |
| 10610 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10611 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10612 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10613 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10614 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10615 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10616 | |
| 10617 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10618 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10619 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10620 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10621 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10622 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10623 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10624 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10625 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10626 | /* FIXME: use matrix-type input source selection */ |
| 10627 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10628 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10629 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10630 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10631 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10632 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10633 | /* Input mixer2 */ |
| 10634 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10635 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10636 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10637 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10638 | /* Input mixer3 */ |
| 10639 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10640 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10641 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10642 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10643 | |
| 10644 | { } |
| 10645 | }; |
| 10646 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10647 | static struct hda_verb alc262_eapd_verbs[] = { |
| 10648 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10649 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10650 | { } |
| 10651 | }; |
| 10652 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10653 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 10654 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10655 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10656 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10657 | |
| 10658 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10659 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10660 | {} |
| 10661 | }; |
| 10662 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10663 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 10664 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10665 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10666 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 10667 | |
| 10668 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10669 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 10670 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10671 | }; |
| 10672 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10673 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 10674 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10675 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10676 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10677 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10678 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10679 | { } /* end */ |
| 10680 | }; |
| 10681 | |
| 10682 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 10683 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10684 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10685 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10686 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10687 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 10688 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10689 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 10690 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10691 | {} |
| 10692 | }; |
| 10693 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10694 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10695 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10696 | struct alc_spec *spec = codec->spec; |
| 10697 | |
| 10698 | spec->autocfg.hp_pins[0] = 0x15; |
| 10699 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10700 | spec->ext_mic.pin = 0x18; |
| 10701 | spec->ext_mic.mux_idx = 0; |
| 10702 | spec->int_mic.pin = 0x12; |
| 10703 | spec->int_mic.mux_idx = 9; |
| 10704 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10705 | } |
| 10706 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10707 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10708 | * nec model |
| 10709 | * 0x15 = headphone |
| 10710 | * 0x16 = internal speaker |
| 10711 | * 0x18 = external mic |
| 10712 | */ |
| 10713 | |
| 10714 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 10715 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 10716 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 10717 | |
| 10718 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10719 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10720 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10721 | |
| 10722 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10723 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10724 | { } /* end */ |
| 10725 | }; |
| 10726 | |
| 10727 | static struct hda_verb alc262_nec_verbs[] = { |
| 10728 | /* Unmute Speaker */ |
| 10729 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10730 | |
| 10731 | /* Headphone */ |
| 10732 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10733 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10734 | |
| 10735 | /* External mic to headphone */ |
| 10736 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10737 | /* External mic to speaker */ |
| 10738 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10739 | {} |
| 10740 | }; |
| 10741 | |
| 10742 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10743 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10744 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 10745 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10746 | */ |
| 10747 | |
| 10748 | #define ALC_HP_EVENT 0x37 |
| 10749 | |
| 10750 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 10751 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10752 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10753 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10754 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10755 | {} |
| 10756 | }; |
| 10757 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10758 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 10759 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10760 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10761 | {} |
| 10762 | }; |
| 10763 | |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 10764 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
| 10765 | /* Front Mic pin: input vref at 50% */ |
| 10766 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 10767 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10768 | {} |
| 10769 | }; |
| 10770 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10771 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10772 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10773 | .items = { |
| 10774 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10775 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10776 | { "CD", 0x4 }, |
| 10777 | }, |
| 10778 | }; |
| 10779 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10780 | static struct hda_input_mux alc262_HP_capture_source = { |
| 10781 | .num_items = 5, |
| 10782 | .items = { |
| 10783 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10784 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10785 | { "Line", 0x2 }, |
| 10786 | { "CD", 0x4 }, |
| 10787 | { "AUX IN", 0x6 }, |
| 10788 | }, |
| 10789 | }; |
| 10790 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10791 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 10792 | .num_items = 4, |
| 10793 | .items = { |
| 10794 | { "Mic", 0x0 }, |
| 10795 | { "Front Mic", 0x2 }, |
| 10796 | { "Line", 0x1 }, |
| 10797 | { "CD", 0x4 }, |
| 10798 | }, |
| 10799 | }; |
| 10800 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10801 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10802 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 10803 | { |
| 10804 | struct alc_spec *spec = codec->spec; |
| 10805 | unsigned int mute; |
| 10806 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10807 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10808 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
| 10809 | snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10810 | spec->sense_updated = 1; |
| 10811 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10812 | /* unmute internal speaker only if both HPs are unplugged and |
| 10813 | * master switch is on |
| 10814 | */ |
| 10815 | if (spec->jack_present) |
| 10816 | mute = HDA_AMP_MUTE; |
| 10817 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10818 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10819 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10820 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10821 | } |
| 10822 | |
| 10823 | /* unsolicited event for HP jack sensing */ |
| 10824 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 10825 | unsigned int res) |
| 10826 | { |
| 10827 | if ((res >> 26) != ALC_HP_EVENT) |
| 10828 | return; |
| 10829 | alc262_fujitsu_automute(codec, 1); |
| 10830 | } |
| 10831 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10832 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 10833 | { |
| 10834 | alc262_fujitsu_automute(codec, 1); |
| 10835 | } |
| 10836 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10837 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10838 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 10839 | .ops = &snd_hda_bind_vol, |
| 10840 | .values = { |
| 10841 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 10842 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 10843 | 0 |
| 10844 | }, |
| 10845 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10846 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10847 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10848 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 10849 | { |
| 10850 | struct alc_spec *spec = codec->spec; |
| 10851 | unsigned int mute; |
| 10852 | |
| 10853 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10854 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10855 | spec->sense_updated = 1; |
| 10856 | } |
| 10857 | if (spec->jack_present) { |
| 10858 | /* mute internal speaker */ |
| 10859 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10860 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10861 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10862 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10863 | } else { |
| 10864 | /* unmute internal speaker if necessary */ |
| 10865 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 10866 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10867 | HDA_AMP_MUTE, mute); |
| 10868 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10869 | HDA_AMP_MUTE, mute); |
| 10870 | } |
| 10871 | } |
| 10872 | |
| 10873 | /* unsolicited event for HP jack sensing */ |
| 10874 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 10875 | unsigned int res) |
| 10876 | { |
| 10877 | if ((res >> 26) != ALC_HP_EVENT) |
| 10878 | return; |
| 10879 | alc262_lenovo_3000_automute(codec, 1); |
| 10880 | } |
| 10881 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10882 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 10883 | int dir, int idx, long *valp) |
| 10884 | { |
| 10885 | int i, change = 0; |
| 10886 | |
| 10887 | for (i = 0; i < 2; i++, valp++) |
| 10888 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 10889 | HDA_AMP_MUTE, |
| 10890 | *valp ? 0 : HDA_AMP_MUTE); |
| 10891 | return change; |
| 10892 | } |
| 10893 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10894 | /* bind hp and internal speaker mute (with plug check) */ |
| 10895 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10896 | struct snd_ctl_elem_value *ucontrol) |
| 10897 | { |
| 10898 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10899 | long *valp = ucontrol->value.integer.value; |
| 10900 | int change; |
| 10901 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10902 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 10903 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 10904 | if (change) |
| 10905 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10906 | return change; |
| 10907 | } |
| 10908 | |
| 10909 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10910 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10911 | { |
| 10912 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10913 | .name = "Master Playback Switch", |
| 10914 | .info = snd_hda_mixer_amp_switch_info, |
| 10915 | .get = snd_hda_mixer_amp_switch_get, |
| 10916 | .put = alc262_fujitsu_master_sw_put, |
| 10917 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10918 | }, |
| 10919 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10920 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10921 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10922 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10923 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10924 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10925 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10926 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10927 | { } /* end */ |
| 10928 | }; |
| 10929 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10930 | /* bind hp and internal speaker mute (with plug check) */ |
| 10931 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10932 | struct snd_ctl_elem_value *ucontrol) |
| 10933 | { |
| 10934 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10935 | long *valp = ucontrol->value.integer.value; |
| 10936 | int change; |
| 10937 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10938 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10939 | if (change) |
| 10940 | alc262_lenovo_3000_automute(codec, 0); |
| 10941 | return change; |
| 10942 | } |
| 10943 | |
| 10944 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 10945 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10946 | { |
| 10947 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10948 | .name = "Master Playback Switch", |
| 10949 | .info = snd_hda_mixer_amp_switch_info, |
| 10950 | .get = snd_hda_mixer_amp_switch_get, |
| 10951 | .put = alc262_lenovo_3000_master_sw_put, |
| 10952 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 10953 | }, |
| 10954 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10955 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10956 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10957 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10958 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10959 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10960 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10961 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10962 | { } /* end */ |
| 10963 | }; |
| 10964 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10965 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 10966 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10967 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10968 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10969 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10970 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10971 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10972 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10973 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10974 | { } /* end */ |
| 10975 | }; |
| 10976 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10977 | /* additional init verbs for Benq laptops */ |
| 10978 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 10979 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10980 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 10981 | {} |
| 10982 | }; |
| 10983 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10984 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 10985 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10986 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10987 | |
| 10988 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10989 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 10990 | {} |
| 10991 | }; |
| 10992 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10993 | /* Samsung Q1 Ultra Vista model setup */ |
| 10994 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10995 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10996 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10997 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10998 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10999 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11000 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11001 | { } /* end */ |
| 11002 | }; |
| 11003 | |
| 11004 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11005 | /* output mixer */ |
| 11006 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11007 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11008 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11009 | /* speaker */ |
| 11010 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11011 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11012 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11013 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11014 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11015 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11016 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11017 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11018 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11019 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11020 | /* internal mic */ |
| 11021 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11022 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11023 | /* ADC, choose mic */ |
| 11024 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11025 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11026 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11027 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11028 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11029 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11030 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11031 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11032 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 11033 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11034 | {} |
| 11035 | }; |
| 11036 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11037 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11038 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 11039 | { |
| 11040 | struct alc_spec *spec = codec->spec; |
| 11041 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11042 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11043 | mute = 0; |
| 11044 | /* auto-mute only when HP is used as HP */ |
| 11045 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11046 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11047 | if (spec->jack_present) |
| 11048 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11049 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11050 | /* mute/unmute internal speaker */ |
| 11051 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11052 | HDA_AMP_MUTE, mute); |
| 11053 | /* mute/unmute HP */ |
| 11054 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11055 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11056 | } |
| 11057 | |
| 11058 | /* unsolicited event for HP jack sensing */ |
| 11059 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 11060 | unsigned int res) |
| 11061 | { |
| 11062 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11063 | return; |
| 11064 | alc262_ultra_automute(codec); |
| 11065 | } |
| 11066 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11067 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 11068 | .num_items = 2, |
| 11069 | .items = { |
| 11070 | { "Mic", 0x1 }, |
| 11071 | { "Headphone", 0x7 }, |
| 11072 | }, |
| 11073 | }; |
| 11074 | |
| 11075 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 11076 | struct snd_ctl_elem_value *ucontrol) |
| 11077 | { |
| 11078 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11079 | struct alc_spec *spec = codec->spec; |
| 11080 | int ret; |
| 11081 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11082 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11083 | if (!ret) |
| 11084 | return 0; |
| 11085 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 11086 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 11087 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11088 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 11089 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 11090 | return ret; |
| 11091 | } |
| 11092 | |
| 11093 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 11094 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 11095 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 11096 | { |
| 11097 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11098 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11099 | .info = alc_mux_enum_info, |
| 11100 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11101 | .put = alc262_ultra_mux_enum_put, |
| 11102 | }, |
| 11103 | { } /* end */ |
| 11104 | }; |
| 11105 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11106 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 11107 | * and thus it's bound with a different mixer. |
| 11108 | * This function returns which mixer amp should be used. |
| 11109 | */ |
| 11110 | static int alc262_check_volbit(hda_nid_t nid) |
| 11111 | { |
| 11112 | if (!nid) |
| 11113 | return 0; |
| 11114 | else if (nid == 0x16) |
| 11115 | return 2; |
| 11116 | else |
| 11117 | return 1; |
| 11118 | } |
| 11119 | |
| 11120 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 11121 | const char *pfx, int *vbits) |
| 11122 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11123 | unsigned long val; |
| 11124 | int vbit; |
| 11125 | |
| 11126 | vbit = alc262_check_volbit(nid); |
| 11127 | if (!vbit) |
| 11128 | return 0; |
| 11129 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 11130 | return 0; |
| 11131 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11132 | if (vbit == 2) |
| 11133 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 11134 | else |
| 11135 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 11136 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11137 | } |
| 11138 | |
| 11139 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 11140 | const char *pfx) |
| 11141 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11142 | unsigned long val; |
| 11143 | |
| 11144 | if (!nid) |
| 11145 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11146 | if (nid == 0x16) |
| 11147 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 11148 | else |
| 11149 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 11150 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11151 | } |
| 11152 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11153 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11154 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11155 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11156 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11157 | const char *pfx; |
| 11158 | int vbits; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11159 | int err; |
| 11160 | |
| 11161 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 11162 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11163 | spec->multiout.dac_nids[0] = 2; |
| 11164 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11165 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 11166 | pfx = "Master"; |
| 11167 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11168 | pfx = "Speaker"; |
| 11169 | else |
| 11170 | pfx = "Front"; |
| 11171 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx); |
| 11172 | if (err < 0) |
| 11173 | return err; |
| 11174 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker"); |
| 11175 | if (err < 0) |
| 11176 | return err; |
| 11177 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone"); |
| 11178 | if (err < 0) |
| 11179 | return err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11180 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11181 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 11182 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 11183 | alc262_check_volbit(cfg->hp_pins[0]); |
| 11184 | if (vbits == 1 || vbits == 2) |
| 11185 | pfx = "Master"; /* only one mixer is used */ |
| 11186 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11187 | pfx = "Speaker"; |
| 11188 | else |
| 11189 | pfx = "Front"; |
| 11190 | vbits = 0; |
| 11191 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits); |
| 11192 | if (err < 0) |
| 11193 | return err; |
| 11194 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker", |
| 11195 | &vbits); |
| 11196 | if (err < 0) |
| 11197 | return err; |
| 11198 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone", |
| 11199 | &vbits); |
| 11200 | if (err < 0) |
| 11201 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11202 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11203 | } |
| 11204 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11205 | #define alc262_auto_create_input_ctls \ |
| 11206 | alc880_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11207 | |
| 11208 | /* |
| 11209 | * generic initialization of ADC, input mixers and output mixers |
| 11210 | */ |
| 11211 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 11212 | /* |
| 11213 | * Unmute ADC0-2 and set the default input to mic-in |
| 11214 | */ |
| 11215 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11216 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11217 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11218 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11219 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11220 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11221 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11222 | /* 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] | 11223 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11224 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11225 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11226 | */ |
| 11227 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11228 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11229 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11230 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11231 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11232 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11233 | |
| 11234 | /* |
| 11235 | * Set up output mixers (0x0c - 0x0f) |
| 11236 | */ |
| 11237 | /* set vol=0 to output mixers */ |
| 11238 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11239 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11240 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11241 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11242 | /* set up input amps for analog loopback */ |
| 11243 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11244 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11245 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11246 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11247 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11248 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11249 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11250 | |
| 11251 | /* FIXME: use matrix-type input source selection */ |
| 11252 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11253 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11254 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11255 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11256 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11257 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11258 | /* Input mixer2 */ |
| 11259 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11260 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11261 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11262 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11263 | /* Input mixer3 */ |
| 11264 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11265 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11266 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11267 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11268 | |
| 11269 | { } |
| 11270 | }; |
| 11271 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11272 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 11273 | /* |
| 11274 | * Unmute ADC0-2 and set the default input to mic-in |
| 11275 | */ |
| 11276 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11277 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11278 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11279 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11280 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11281 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11282 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11283 | /* 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] | 11284 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11285 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11286 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11287 | */ |
| 11288 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11289 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11290 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11291 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11292 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11293 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11294 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11295 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11296 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11297 | /* |
| 11298 | * Set up output mixers (0x0c - 0x0e) |
| 11299 | */ |
| 11300 | /* set vol=0 to output mixers */ |
| 11301 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11302 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11303 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11304 | |
| 11305 | /* set up input amps for analog loopback */ |
| 11306 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11307 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11308 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11309 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11310 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11311 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11312 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11313 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11314 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11315 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11316 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11317 | |
| 11318 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11319 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11320 | |
| 11321 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11322 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11323 | |
| 11324 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11325 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11326 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11327 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11328 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11329 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11330 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11331 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11332 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11333 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11334 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11335 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11336 | |
| 11337 | |
| 11338 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11339 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 11340 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11341 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11342 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11343 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11344 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11345 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11346 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11347 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11348 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11349 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11350 | /* Input mixer2 */ |
| 11351 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11352 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11353 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11354 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11355 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11356 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11357 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11358 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11359 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11360 | /* Input mixer3 */ |
| 11361 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11362 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11363 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11364 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11365 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11366 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11367 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11368 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11369 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11370 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11371 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11372 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11373 | { } |
| 11374 | }; |
| 11375 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11376 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 11377 | /* |
| 11378 | * Unmute ADC0-2 and set the default input to mic-in |
| 11379 | */ |
| 11380 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11381 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11382 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11383 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11384 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11385 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11386 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11387 | /* 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] | 11388 | * mixer widget |
| 11389 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 11390 | * panel mic (mic 2) |
| 11391 | */ |
| 11392 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11393 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11394 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11395 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11396 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11397 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11398 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11399 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11400 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11401 | /* |
| 11402 | * Set up output mixers (0x0c - 0x0e) |
| 11403 | */ |
| 11404 | /* set vol=0 to output mixers */ |
| 11405 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11406 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11407 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11408 | |
| 11409 | /* set up input amps for analog loopback */ |
| 11410 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11411 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11412 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11413 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11414 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11415 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11416 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11417 | |
| 11418 | |
| 11419 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 11420 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 11421 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 11422 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 11423 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11424 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 11425 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 11426 | |
| 11427 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11428 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11429 | |
| 11430 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11431 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11432 | |
| 11433 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 11434 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11435 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11436 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 11437 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11438 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11439 | |
| 11440 | /* FIXME: use matrix-type input source selection */ |
| 11441 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11442 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11443 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 11444 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 11445 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 11446 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 11447 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 11448 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11449 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 11450 | /* Input mixer2 */ |
| 11451 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11452 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11453 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11454 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11455 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11456 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11457 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11458 | /* Input mixer3 */ |
| 11459 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11460 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11461 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11462 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11463 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11464 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11465 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11466 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11467 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11468 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11469 | { } |
| 11470 | }; |
| 11471 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11472 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 11473 | |
| 11474 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 11475 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11476 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11477 | |
| 11478 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 11479 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11480 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11481 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11482 | |
| 11483 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 11484 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11485 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11486 | {} |
| 11487 | }; |
| 11488 | |
| 11489 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11490 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11491 | #define alc262_loopbacks alc880_loopbacks |
| 11492 | #endif |
| 11493 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 11494 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11495 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 11496 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 11497 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 11498 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 11499 | |
| 11500 | /* |
| 11501 | * BIOS auto configuration |
| 11502 | */ |
| 11503 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 11504 | { |
| 11505 | struct alc_spec *spec = codec->spec; |
| 11506 | int err; |
| 11507 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 11508 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11509 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11510 | alc262_ignore); |
| 11511 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11512 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11513 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11514 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11515 | spec->multiout.max_channels = 2; |
| 11516 | spec->no_analog = 1; |
| 11517 | goto dig_only; |
| 11518 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11519 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11520 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11521 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11522 | if (err < 0) |
| 11523 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11524 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11525 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11526 | return err; |
| 11527 | |
| 11528 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11529 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11530 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11531 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11532 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11533 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11534 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11535 | if (spec->autocfg.dig_in_pin) |
| 11536 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 11537 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 11538 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11539 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11540 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11541 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11542 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11543 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11544 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11545 | err = alc_auto_add_mic_boost(codec); |
| 11546 | if (err < 0) |
| 11547 | return err; |
| 11548 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 11549 | alc_ssid_check(codec, 0x15, 0x14, 0x1b); |
| 11550 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11551 | return 1; |
| 11552 | } |
| 11553 | |
| 11554 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 11555 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 11556 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11557 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11558 | |
| 11559 | |
| 11560 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11561 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11562 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11563 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11564 | alc262_auto_init_multi_out(codec); |
| 11565 | alc262_auto_init_hp_out(codec); |
| 11566 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11567 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11568 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11569 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11570 | } |
| 11571 | |
| 11572 | /* |
| 11573 | * configuration and preset |
| 11574 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11575 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 11576 | [ALC262_BASIC] = "basic", |
| 11577 | [ALC262_HIPPO] = "hippo", |
| 11578 | [ALC262_HIPPO_1] = "hippo_1", |
| 11579 | [ALC262_FUJITSU] = "fujitsu", |
| 11580 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11581 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 11582 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11583 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11584 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 11585 | [ALC262_BENQ_T31] = "benq-t31", |
| 11586 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 11587 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11588 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11589 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11590 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11591 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11592 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11593 | [ALC262_AUTO] = "auto", |
| 11594 | }; |
| 11595 | |
| 11596 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 11597 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11598 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11599 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 11600 | ALC262_HP_BPC), |
| 11601 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 11602 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 11603 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 11604 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11605 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11606 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11607 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11608 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11609 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11610 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11611 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11612 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11613 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 11614 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 11615 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11616 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 11617 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11618 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11619 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11620 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11621 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 11622 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 11623 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 11624 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 11625 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 11626 | #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] | 11627 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 11628 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 11629 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 11630 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11631 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 11632 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11633 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 11634 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11635 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11636 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 11637 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 11638 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11639 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11640 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11641 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11642 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11643 | {} |
| 11644 | }; |
| 11645 | |
| 11646 | static struct alc_config_preset alc262_presets[] = { |
| 11647 | [ALC262_BASIC] = { |
| 11648 | .mixers = { alc262_base_mixer }, |
| 11649 | .init_verbs = { alc262_init_verbs }, |
| 11650 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11651 | .dac_nids = alc262_dac_nids, |
| 11652 | .hp_nid = 0x03, |
| 11653 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11654 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 11655 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11656 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11657 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11658 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 11659 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11660 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11661 | .dac_nids = alc262_dac_nids, |
| 11662 | .hp_nid = 0x03, |
| 11663 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11664 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11665 | .channel_mode = alc262_modes, |
| 11666 | .input_mux = &alc262_capture_source, |
| 11667 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11668 | .setup = alc262_hippo_setup, |
| 11669 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11670 | }, |
| 11671 | [ALC262_HIPPO_1] = { |
| 11672 | .mixers = { alc262_hippo1_mixer }, |
| 11673 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 11674 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11675 | .dac_nids = alc262_dac_nids, |
| 11676 | .hp_nid = 0x02, |
| 11677 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11678 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11679 | .channel_mode = alc262_modes, |
| 11680 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11681 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11682 | .setup = alc262_hippo1_setup, |
| 11683 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11684 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11685 | [ALC262_FUJITSU] = { |
| 11686 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11687 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11688 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11689 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11690 | .dac_nids = alc262_dac_nids, |
| 11691 | .hp_nid = 0x03, |
| 11692 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11693 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11694 | .channel_mode = alc262_modes, |
| 11695 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11696 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11697 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11698 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11699 | [ALC262_HP_BPC] = { |
| 11700 | .mixers = { alc262_HP_BPC_mixer }, |
| 11701 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 11702 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11703 | .dac_nids = alc262_dac_nids, |
| 11704 | .hp_nid = 0x03, |
| 11705 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11706 | .channel_mode = alc262_modes, |
| 11707 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11708 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 11709 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11710 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11711 | [ALC262_HP_BPC_D7000_WF] = { |
| 11712 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 11713 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11714 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11715 | .dac_nids = alc262_dac_nids, |
| 11716 | .hp_nid = 0x03, |
| 11717 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11718 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11719 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11720 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11721 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11722 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11723 | [ALC262_HP_BPC_D7000_WL] = { |
| 11724 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 11725 | alc262_HP_BPC_WildWest_option_mixer }, |
| 11726 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11727 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11728 | .dac_nids = alc262_dac_nids, |
| 11729 | .hp_nid = 0x03, |
| 11730 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11731 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11732 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11733 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11734 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11735 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11736 | [ALC262_HP_TC_T5735] = { |
| 11737 | .mixers = { alc262_hp_t5735_mixer }, |
| 11738 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 11739 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11740 | .dac_nids = alc262_dac_nids, |
| 11741 | .hp_nid = 0x03, |
| 11742 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11743 | .channel_mode = alc262_modes, |
| 11744 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11745 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11746 | .setup = alc262_hp_t5735_setup, |
| 11747 | .init_hook = alc_automute_amp, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11748 | }, |
| 11749 | [ALC262_HP_RP5700] = { |
| 11750 | .mixers = { alc262_hp_rp5700_mixer }, |
| 11751 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 11752 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11753 | .dac_nids = alc262_dac_nids, |
| 11754 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11755 | .channel_mode = alc262_modes, |
| 11756 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11757 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11758 | [ALC262_BENQ_ED8] = { |
| 11759 | .mixers = { alc262_base_mixer }, |
| 11760 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 11761 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11762 | .dac_nids = alc262_dac_nids, |
| 11763 | .hp_nid = 0x03, |
| 11764 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11765 | .channel_mode = alc262_modes, |
| 11766 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11767 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11768 | [ALC262_SONY_ASSAMD] = { |
| 11769 | .mixers = { alc262_sony_mixer }, |
| 11770 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 11771 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11772 | .dac_nids = alc262_dac_nids, |
| 11773 | .hp_nid = 0x02, |
| 11774 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11775 | .channel_mode = alc262_modes, |
| 11776 | .input_mux = &alc262_capture_source, |
| 11777 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11778 | .setup = alc262_hippo_setup, |
| 11779 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11780 | }, |
| 11781 | [ALC262_BENQ_T31] = { |
| 11782 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 11783 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 11784 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11785 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11786 | .dac_nids = alc262_dac_nids, |
| 11787 | .hp_nid = 0x03, |
| 11788 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11789 | .channel_mode = alc262_modes, |
| 11790 | .input_mux = &alc262_capture_source, |
| 11791 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11792 | .setup = alc262_hippo_setup, |
| 11793 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11794 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11795 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11796 | .mixers = { alc262_ultra_mixer }, |
| 11797 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11798 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11799 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11800 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11801 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11802 | .channel_mode = alc262_modes, |
| 11803 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11804 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 11805 | .capsrc_nids = alc262_capsrc_nids, |
| 11806 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11807 | .unsol_event = alc262_ultra_unsol_event, |
| 11808 | .init_hook = alc262_ultra_automute, |
| 11809 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11810 | [ALC262_LENOVO_3000] = { |
| 11811 | .mixers = { alc262_lenovo_3000_mixer }, |
| 11812 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11813 | alc262_lenovo_3000_unsol_verbs, |
| 11814 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11815 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11816 | .dac_nids = alc262_dac_nids, |
| 11817 | .hp_nid = 0x03, |
| 11818 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11819 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11820 | .channel_mode = alc262_modes, |
| 11821 | .input_mux = &alc262_fujitsu_capture_source, |
| 11822 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 11823 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11824 | [ALC262_NEC] = { |
| 11825 | .mixers = { alc262_nec_mixer }, |
| 11826 | .init_verbs = { alc262_nec_verbs }, |
| 11827 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11828 | .dac_nids = alc262_dac_nids, |
| 11829 | .hp_nid = 0x03, |
| 11830 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11831 | .channel_mode = alc262_modes, |
| 11832 | .input_mux = &alc262_capture_source, |
| 11833 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11834 | [ALC262_TOSHIBA_S06] = { |
| 11835 | .mixers = { alc262_toshiba_s06_mixer }, |
| 11836 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 11837 | alc262_eapd_verbs }, |
| 11838 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11839 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 11840 | .dac_nids = alc262_dac_nids, |
| 11841 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 11842 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11843 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11844 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11845 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11846 | .unsol_event = alc_sku_unsol_event, |
| 11847 | .setup = alc262_toshiba_s06_setup, |
| 11848 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11849 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11850 | [ALC262_TOSHIBA_RX1] = { |
| 11851 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 11852 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 11853 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11854 | .dac_nids = alc262_dac_nids, |
| 11855 | .hp_nid = 0x03, |
| 11856 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11857 | .channel_mode = alc262_modes, |
| 11858 | .input_mux = &alc262_capture_source, |
| 11859 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11860 | .setup = alc262_hippo_setup, |
| 11861 | .init_hook = alc262_hippo_automute, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11862 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11863 | [ALC262_TYAN] = { |
| 11864 | .mixers = { alc262_tyan_mixer }, |
| 11865 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 11866 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11867 | .dac_nids = alc262_dac_nids, |
| 11868 | .hp_nid = 0x02, |
| 11869 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11870 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11871 | .channel_mode = alc262_modes, |
| 11872 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11873 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11874 | .setup = alc262_tyan_setup, |
| 11875 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11876 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11877 | }; |
| 11878 | |
| 11879 | static int patch_alc262(struct hda_codec *codec) |
| 11880 | { |
| 11881 | struct alc_spec *spec; |
| 11882 | int board_config; |
| 11883 | int err; |
| 11884 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11885 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11886 | if (spec == NULL) |
| 11887 | return -ENOMEM; |
| 11888 | |
| 11889 | codec->spec = spec; |
| 11890 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11891 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 11892 | * under-run |
| 11893 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11894 | { |
| 11895 | int tmp; |
| 11896 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11897 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 11898 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11899 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 11900 | } |
| 11901 | #endif |
| 11902 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11903 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11904 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11905 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 11906 | alc262_models, |
| 11907 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11908 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11909 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 11910 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 11911 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11912 | board_config = ALC262_AUTO; |
| 11913 | } |
| 11914 | |
| 11915 | if (board_config == ALC262_AUTO) { |
| 11916 | /* automatic parse from the BIOS config */ |
| 11917 | err = alc262_parse_auto_config(codec); |
| 11918 | if (err < 0) { |
| 11919 | alc_free(codec); |
| 11920 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11921 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11922 | printk(KERN_INFO |
| 11923 | "hda_codec: Cannot set up configuration " |
| 11924 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11925 | board_config = ALC262_BASIC; |
| 11926 | } |
| 11927 | } |
| 11928 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11929 | if (!spec->no_analog) { |
| 11930 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11931 | if (err < 0) { |
| 11932 | alc_free(codec); |
| 11933 | return err; |
| 11934 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11935 | } |
| 11936 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11937 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 11938 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11939 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11940 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 11941 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11942 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11943 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 11944 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 11945 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11946 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11947 | int i; |
| 11948 | /* check whether the digital-mic has to be supported */ |
| 11949 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 11950 | if (spec->input_mux->items[i].index >= 9) |
| 11951 | break; |
| 11952 | } |
| 11953 | if (i < spec->input_mux->num_items) { |
| 11954 | /* use only ADC0 */ |
| 11955 | spec->adc_nids = alc262_dmic_adc_nids; |
| 11956 | spec->num_adc_nids = 1; |
| 11957 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11958 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11959 | /* all analog inputs */ |
| 11960 | /* check whether NID 0x07 is valid */ |
| 11961 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 11962 | |
| 11963 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 11964 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11965 | if (wcap != AC_WID_AUD_IN) { |
| 11966 | spec->adc_nids = alc262_adc_nids_alt; |
| 11967 | spec->num_adc_nids = |
| 11968 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 11969 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 11970 | } else { |
| 11971 | spec->adc_nids = alc262_adc_nids; |
| 11972 | spec->num_adc_nids = |
| 11973 | ARRAY_SIZE(alc262_adc_nids); |
| 11974 | spec->capsrc_nids = alc262_capsrc_nids; |
| 11975 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11976 | } |
| 11977 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11978 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 11979 | set_capture_mixer(codec); |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11980 | if (!spec->no_analog) |
| 11981 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11982 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11983 | spec->vmaster_nid = 0x0c; |
| 11984 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11985 | codec->patch_ops = alc_patch_ops; |
| 11986 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11987 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11988 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11989 | if (!spec->loopback.amplist) |
| 11990 | spec->loopback.amplist = alc262_loopbacks; |
| 11991 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 11992 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11993 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11994 | return 0; |
| 11995 | } |
| 11996 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11997 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11998 | * ALC268 channel source setting (2 channel) |
| 11999 | */ |
| 12000 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 12001 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12002 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12003 | static hda_nid_t alc268_dac_nids[2] = { |
| 12004 | /* front, hp */ |
| 12005 | 0x02, 0x03 |
| 12006 | }; |
| 12007 | |
| 12008 | static hda_nid_t alc268_adc_nids[2] = { |
| 12009 | /* ADC0-1 */ |
| 12010 | 0x08, 0x07 |
| 12011 | }; |
| 12012 | |
| 12013 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 12014 | /* ADC0 */ |
| 12015 | 0x08 |
| 12016 | }; |
| 12017 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12018 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 12019 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12020 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 12021 | /* output mixer control */ |
| 12022 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12023 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12024 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12025 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12026 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12027 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12028 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12029 | { } |
| 12030 | }; |
| 12031 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12032 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 12033 | /* output mixer control */ |
| 12034 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12035 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12036 | ALC262_HIPPO_MASTER_SWITCH, |
| 12037 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12038 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12039 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12040 | { } |
| 12041 | }; |
| 12042 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12043 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 12044 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 12045 | .ops = &snd_hda_bind_sw, |
| 12046 | .values = { |
| 12047 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 12048 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 12049 | 0 |
| 12050 | }, |
| 12051 | }; |
| 12052 | |
| 12053 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 12054 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 12055 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 12056 | { } |
| 12057 | }; |
| 12058 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12059 | static struct hda_verb alc268_eapd_verbs[] = { |
| 12060 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12061 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12062 | { } |
| 12063 | }; |
| 12064 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12065 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12066 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 12067 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12068 | { } /* end */ |
| 12069 | }; |
| 12070 | |
| 12071 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12072 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 12073 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 12074 | .ops = &snd_hda_bind_vol, |
| 12075 | .values = { |
| 12076 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12077 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12078 | 0 |
| 12079 | }, |
| 12080 | }; |
| 12081 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12082 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 12083 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 12084 | { |
| 12085 | struct alc_spec *spec = codec->spec; |
| 12086 | unsigned int mute; |
| 12087 | |
| 12088 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12089 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12090 | spec->sense_updated = 1; |
| 12091 | } |
| 12092 | if (spec->jack_present) |
| 12093 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 12094 | else /* unmute internal speaker if necessary */ |
| 12095 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 12096 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12097 | HDA_AMP_MUTE, mute); |
| 12098 | } |
| 12099 | |
| 12100 | |
| 12101 | /* bind hp and internal speaker mute (with plug check) */ |
| 12102 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 12103 | struct snd_ctl_elem_value *ucontrol) |
| 12104 | { |
| 12105 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12106 | long *valp = ucontrol->value.integer.value; |
| 12107 | int change; |
| 12108 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 12109 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12110 | if (change) |
| 12111 | alc268_acer_automute(codec, 0); |
| 12112 | return change; |
| 12113 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12114 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12115 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 12116 | /* output mixer control */ |
| 12117 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12118 | { |
| 12119 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12120 | .name = "Master Playback Switch", |
| 12121 | .info = snd_hda_mixer_amp_switch_info, |
| 12122 | .get = snd_hda_mixer_amp_switch_get, |
| 12123 | .put = alc268_acer_master_sw_put, |
| 12124 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12125 | }, |
| 12126 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 12127 | { } |
| 12128 | }; |
| 12129 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12130 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 12131 | /* output mixer control */ |
| 12132 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12133 | { |
| 12134 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12135 | .name = "Master Playback Switch", |
| 12136 | .info = snd_hda_mixer_amp_switch_info, |
| 12137 | .get = snd_hda_mixer_amp_switch_get, |
| 12138 | .put = alc268_acer_master_sw_put, |
| 12139 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12140 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12141 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12142 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12143 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12144 | { } |
| 12145 | }; |
| 12146 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12147 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 12148 | /* output mixer control */ |
| 12149 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12150 | { |
| 12151 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12152 | .name = "Master Playback Switch", |
| 12153 | .info = snd_hda_mixer_amp_switch_info, |
| 12154 | .get = snd_hda_mixer_amp_switch_get, |
| 12155 | .put = alc268_acer_master_sw_put, |
| 12156 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12157 | }, |
| 12158 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12159 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12160 | { } |
| 12161 | }; |
| 12162 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12163 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 12164 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12165 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12166 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12167 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12168 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 12169 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 12170 | { } |
| 12171 | }; |
| 12172 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12173 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12174 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 12175 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12176 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12177 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12178 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12179 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12180 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12181 | { } |
| 12182 | }; |
| 12183 | |
| 12184 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12185 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12186 | #define alc268_toshiba_setup alc262_hippo_setup |
| 12187 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12188 | |
| 12189 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 12190 | unsigned int res) |
| 12191 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12192 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12193 | return; |
| 12194 | alc268_acer_automute(codec, 1); |
| 12195 | } |
| 12196 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12197 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 12198 | { |
| 12199 | alc268_acer_automute(codec, 1); |
| 12200 | } |
| 12201 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12202 | /* toggle speaker-output according to the hp-jack state */ |
| 12203 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 12204 | { |
| 12205 | unsigned int present; |
| 12206 | unsigned char bits; |
| 12207 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12208 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12209 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12210 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 12211 | AMP_IN_MUTE(0), bits); |
| 12212 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 12213 | AMP_IN_MUTE(0), bits); |
| 12214 | } |
| 12215 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12216 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 12217 | unsigned int res) |
| 12218 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12219 | switch (res >> 26) { |
| 12220 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12221 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12222 | break; |
| 12223 | case ALC880_MIC_EVENT: |
| 12224 | alc_mic_automute(codec); |
| 12225 | break; |
| 12226 | } |
| 12227 | } |
| 12228 | |
| 12229 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 12230 | { |
| 12231 | struct alc_spec *spec = codec->spec; |
| 12232 | spec->ext_mic.pin = 0x18; |
| 12233 | spec->ext_mic.mux_idx = 0; |
| 12234 | spec->int_mic.pin = 0x12; |
| 12235 | spec->int_mic.mux_idx = 6; |
| 12236 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12237 | } |
| 12238 | |
| 12239 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 12240 | { |
| 12241 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12242 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12243 | } |
| 12244 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12245 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 12246 | /* output mixer control */ |
| 12247 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12248 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12249 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12250 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12251 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12252 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12253 | { } |
| 12254 | }; |
| 12255 | |
| 12256 | static struct hda_verb alc268_dell_verbs[] = { |
| 12257 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12258 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12259 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12260 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12261 | { } |
| 12262 | }; |
| 12263 | |
| 12264 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12265 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12266 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12267 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12268 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12269 | spec->autocfg.hp_pins[0] = 0x15; |
| 12270 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12271 | spec->ext_mic.pin = 0x18; |
| 12272 | spec->ext_mic.mux_idx = 0; |
| 12273 | spec->int_mic.pin = 0x19; |
| 12274 | spec->int_mic.mux_idx = 1; |
| 12275 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12276 | } |
| 12277 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12278 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 12279 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12280 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12281 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12282 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12283 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12284 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12285 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 12286 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 12287 | { } |
| 12288 | }; |
| 12289 | |
| 12290 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 12291 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12292 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 12293 | { } |
| 12294 | }; |
| 12295 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12296 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12297 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12298 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12299 | spec->autocfg.hp_pins[0] = 0x15; |
| 12300 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12301 | spec->ext_mic.pin = 0x18; |
| 12302 | spec->ext_mic.mux_idx = 0; |
| 12303 | spec->int_mic.pin = 0x19; |
| 12304 | spec->int_mic.mux_idx = 1; |
| 12305 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12306 | } |
| 12307 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12308 | /* |
| 12309 | * generic initialization of ADC, input mixers and output mixers |
| 12310 | */ |
| 12311 | static struct hda_verb alc268_base_init_verbs[] = { |
| 12312 | /* Unmute DAC0-1 and set vol = 0 */ |
| 12313 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12314 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12315 | |
| 12316 | /* |
| 12317 | * Set up output mixers (0x0c - 0x0e) |
| 12318 | */ |
| 12319 | /* set vol=0 to output mixers */ |
| 12320 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12321 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12322 | |
| 12323 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12324 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12325 | |
| 12326 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12327 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 12328 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12329 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12330 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12331 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12332 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12333 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12334 | |
| 12335 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12336 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12337 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12338 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12339 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12340 | |
| 12341 | /* set PCBEEP vol = 0, mute connections */ |
| 12342 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12343 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12344 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12345 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12346 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12347 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12348 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12349 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12350 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12351 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12352 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12353 | { } |
| 12354 | }; |
| 12355 | |
| 12356 | /* |
| 12357 | * generic initialization of ADC, input mixers and output mixers |
| 12358 | */ |
| 12359 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 12360 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 12361 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12362 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12363 | |
| 12364 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12365 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12366 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12367 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12368 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12369 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12370 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12371 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12372 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12373 | |
| 12374 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12375 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12376 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12377 | /* set PCBEEP vol = 0, mute connections */ |
| 12378 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12379 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12380 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12381 | |
| 12382 | { } |
| 12383 | }; |
| 12384 | |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12385 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 12386 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12387 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12388 | { } /* end */ |
| 12389 | }; |
| 12390 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12391 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 12392 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12393 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12394 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12395 | { } /* end */ |
| 12396 | }; |
| 12397 | |
| 12398 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 12399 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12400 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12401 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 12402 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12403 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12404 | { } /* end */ |
| 12405 | }; |
| 12406 | |
| 12407 | static struct hda_input_mux alc268_capture_source = { |
| 12408 | .num_items = 4, |
| 12409 | .items = { |
| 12410 | { "Mic", 0x0 }, |
| 12411 | { "Front Mic", 0x1 }, |
| 12412 | { "Line", 0x2 }, |
| 12413 | { "CD", 0x3 }, |
| 12414 | }, |
| 12415 | }; |
| 12416 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12417 | static struct hda_input_mux alc268_acer_capture_source = { |
| 12418 | .num_items = 3, |
| 12419 | .items = { |
| 12420 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12421 | { "Internal Mic", 0x1 }, |
| 12422 | { "Line", 0x2 }, |
| 12423 | }, |
| 12424 | }; |
| 12425 | |
| 12426 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 12427 | .num_items = 3, |
| 12428 | .items = { |
| 12429 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12430 | { "Internal Mic", 0x6 }, |
| 12431 | { "Line", 0x2 }, |
| 12432 | }, |
| 12433 | }; |
| 12434 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12435 | #ifdef CONFIG_SND_DEBUG |
| 12436 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12437 | /* Volume widgets */ |
| 12438 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12439 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12440 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 12441 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 12442 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 12443 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 12444 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 12445 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 12446 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 12447 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 12448 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 12449 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 12450 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 12451 | /* The below appears problematic on some hardwares */ |
| 12452 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12453 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12454 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12455 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 12456 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 12457 | |
| 12458 | /* Modes for retasking pin widgets */ |
| 12459 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 12460 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 12461 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 12462 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 12463 | |
| 12464 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 12465 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 12466 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 12467 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 12468 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 12469 | |
| 12470 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 12471 | * The ALC268 does not have an SPDIF input. |
| 12472 | */ |
| 12473 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 12474 | |
| 12475 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 12476 | * this output to turn on an external amplifier. |
| 12477 | */ |
| 12478 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 12479 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 12480 | |
| 12481 | { } /* end */ |
| 12482 | }; |
| 12483 | #endif |
| 12484 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12485 | /* create input playback/capture controls for the given pin */ |
| 12486 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 12487 | const char *ctlname, int idx) |
| 12488 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12489 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12490 | int err; |
| 12491 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12492 | switch (nid) { |
| 12493 | case 0x14: |
| 12494 | case 0x16: |
| 12495 | dac = 0x02; |
| 12496 | break; |
| 12497 | case 0x15: |
| 12498 | dac = 0x03; |
| 12499 | break; |
| 12500 | default: |
| 12501 | return 0; |
| 12502 | } |
| 12503 | if (spec->multiout.dac_nids[0] != dac && |
| 12504 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12505 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12506 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12507 | HDA_OUTPUT)); |
| 12508 | if (err < 0) |
| 12509 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12510 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 12511 | } |
| 12512 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12513 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12514 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12515 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12516 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12517 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12518 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12519 | if (err < 0) |
| 12520 | return err; |
| 12521 | return 0; |
| 12522 | } |
| 12523 | |
| 12524 | /* add playback controls from the parsed DAC table */ |
| 12525 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12526 | const struct auto_pin_cfg *cfg) |
| 12527 | { |
| 12528 | hda_nid_t nid; |
| 12529 | int err; |
| 12530 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12531 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12532 | |
| 12533 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12534 | if (nid) { |
| 12535 | const char *name; |
| 12536 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 12537 | name = "Speaker"; |
| 12538 | else |
| 12539 | name = "Front"; |
| 12540 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 12541 | if (err < 0) |
| 12542 | return err; |
| 12543 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12544 | |
| 12545 | nid = cfg->speaker_pins[0]; |
| 12546 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12547 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12548 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 12549 | if (err < 0) |
| 12550 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12551 | } else { |
| 12552 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 12553 | if (err < 0) |
| 12554 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12555 | } |
| 12556 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12557 | if (nid) { |
| 12558 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 12559 | if (err < 0) |
| 12560 | return err; |
| 12561 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12562 | |
| 12563 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 12564 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12565 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12566 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12567 | if (err < 0) |
| 12568 | return err; |
| 12569 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12570 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12571 | } |
| 12572 | |
| 12573 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12574 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12575 | const struct auto_pin_cfg *cfg) |
| 12576 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12577 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12578 | } |
| 12579 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 12580 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 12581 | hda_nid_t nid, int pin_type) |
| 12582 | { |
| 12583 | int idx; |
| 12584 | |
| 12585 | alc_set_pin_output(codec, nid, pin_type); |
| 12586 | if (nid == 0x14 || nid == 0x16) |
| 12587 | idx = 0; |
| 12588 | else |
| 12589 | idx = 1; |
| 12590 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 12591 | } |
| 12592 | |
| 12593 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 12594 | { |
| 12595 | struct alc_spec *spec = codec->spec; |
| 12596 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 12597 | if (nid) { |
| 12598 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 12599 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 12600 | } |
| 12601 | } |
| 12602 | |
| 12603 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 12604 | { |
| 12605 | struct alc_spec *spec = codec->spec; |
| 12606 | hda_nid_t pin; |
| 12607 | |
| 12608 | pin = spec->autocfg.hp_pins[0]; |
| 12609 | if (pin) |
| 12610 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 12611 | pin = spec->autocfg.speaker_pins[0]; |
| 12612 | if (pin) |
| 12613 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 12614 | } |
| 12615 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12616 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 12617 | { |
| 12618 | struct alc_spec *spec = codec->spec; |
| 12619 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 12620 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 12621 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 12622 | unsigned int dac_vol1, dac_vol2; |
| 12623 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 12624 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12625 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 12626 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 12627 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12628 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12629 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12630 | AMP_IN_UNMUTE(1)); |
| 12631 | snd_hda_codec_write(codec, 0x10, 0, |
| 12632 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12633 | AMP_IN_UNMUTE(1)); |
| 12634 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 12635 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12636 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12637 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12638 | snd_hda_codec_write(codec, 0x10, 0, |
| 12639 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12640 | } |
| 12641 | |
| 12642 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12643 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12644 | dac_vol2 = AMP_OUT_ZERO; |
| 12645 | else if (line_nid == 0x15) |
| 12646 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12647 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12648 | dac_vol2 = AMP_OUT_ZERO; |
| 12649 | else if (hp_nid == 0x15) |
| 12650 | dac_vol1 = AMP_OUT_ZERO; |
| 12651 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 12652 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 12653 | spec->autocfg.line_out_pins[2] != 0x16) |
| 12654 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 12655 | |
| 12656 | snd_hda_codec_write(codec, 0x02, 0, |
| 12657 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 12658 | snd_hda_codec_write(codec, 0x03, 0, |
| 12659 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 12660 | } |
| 12661 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12662 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12663 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 12664 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12665 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12666 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 12667 | |
| 12668 | /* |
| 12669 | * BIOS auto configuration |
| 12670 | */ |
| 12671 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 12672 | { |
| 12673 | struct alc_spec *spec = codec->spec; |
| 12674 | int err; |
| 12675 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 12676 | |
| 12677 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12678 | alc268_ignore); |
| 12679 | if (err < 0) |
| 12680 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12681 | if (!spec->autocfg.line_outs) { |
| 12682 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 12683 | spec->multiout.max_channels = 2; |
| 12684 | spec->no_analog = 1; |
| 12685 | goto dig_only; |
| 12686 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12687 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12688 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12689 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12690 | if (err < 0) |
| 12691 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12692 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12693 | if (err < 0) |
| 12694 | return err; |
| 12695 | |
| 12696 | spec->multiout.max_channels = 2; |
| 12697 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12698 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12699 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12700 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12701 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12702 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 12703 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12704 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12705 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12706 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 12707 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12708 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12709 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12710 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 12711 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12712 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12713 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12714 | err = alc_auto_add_mic_boost(codec); |
| 12715 | if (err < 0) |
| 12716 | return err; |
| 12717 | |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 12718 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 12719 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12720 | return 1; |
| 12721 | } |
| 12722 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12723 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 12724 | |
| 12725 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12726 | static void alc268_auto_init(struct hda_codec *codec) |
| 12727 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12728 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12729 | alc268_auto_init_multi_out(codec); |
| 12730 | alc268_auto_init_hp_out(codec); |
| 12731 | alc268_auto_init_mono_speaker_out(codec); |
| 12732 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12733 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12734 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12735 | } |
| 12736 | |
| 12737 | /* |
| 12738 | * configuration and preset |
| 12739 | */ |
| 12740 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12741 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12742 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12743 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12744 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12745 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12746 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12747 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12748 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12749 | #ifdef CONFIG_SND_DEBUG |
| 12750 | [ALC268_TEST] = "test", |
| 12751 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12752 | [ALC268_AUTO] = "auto", |
| 12753 | }; |
| 12754 | |
| 12755 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 12756 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12757 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 12758 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12759 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 12760 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12761 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 12762 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12763 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 12764 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 12765 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 12766 | /* almost compatible with toshiba but with optional digital outs; |
| 12767 | * auto-probing seems working fine |
| 12768 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12769 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 12770 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12771 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12772 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 12773 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 12774 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12775 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12776 | SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12777 | {} |
| 12778 | }; |
| 12779 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 12780 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 12781 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 12782 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 12783 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 12784 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 12785 | ALC268_TOSHIBA), |
| 12786 | {} |
| 12787 | }; |
| 12788 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12789 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12790 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12791 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 12792 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12793 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12794 | alc267_quanta_il1_verbs }, |
| 12795 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12796 | .dac_nids = alc268_dac_nids, |
| 12797 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12798 | .adc_nids = alc268_adc_nids_alt, |
| 12799 | .hp_nid = 0x03, |
| 12800 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12801 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12802 | .unsol_event = alc_sku_unsol_event, |
| 12803 | .setup = alc267_quanta_il1_setup, |
| 12804 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12805 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12806 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12807 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12808 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12809 | .init_verbs = { alc268_base_init_verbs }, |
| 12810 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12811 | .dac_nids = alc268_dac_nids, |
| 12812 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12813 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12814 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12815 | .hp_nid = 0x03, |
| 12816 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12817 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12818 | .channel_mode = alc268_modes, |
| 12819 | .input_mux = &alc268_capture_source, |
| 12820 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12821 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12822 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12823 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12824 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12825 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12826 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12827 | .dac_nids = alc268_dac_nids, |
| 12828 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12829 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12830 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12831 | .hp_nid = 0x03, |
| 12832 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12833 | .channel_mode = alc268_modes, |
| 12834 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12835 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12836 | .setup = alc268_toshiba_setup, |
| 12837 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12838 | }, |
| 12839 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 12840 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12841 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12842 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12843 | alc268_acer_verbs }, |
| 12844 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12845 | .dac_nids = alc268_dac_nids, |
| 12846 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12847 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12848 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12849 | .hp_nid = 0x02, |
| 12850 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12851 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12852 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12853 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12854 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12855 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12856 | [ALC268_ACER_DMIC] = { |
| 12857 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 12858 | alc268_beep_mixer }, |
| 12859 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12860 | alc268_acer_verbs }, |
| 12861 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12862 | .dac_nids = alc268_dac_nids, |
| 12863 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12864 | .adc_nids = alc268_adc_nids_alt, |
| 12865 | .capsrc_nids = alc268_capsrc_nids, |
| 12866 | .hp_nid = 0x02, |
| 12867 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12868 | .channel_mode = alc268_modes, |
| 12869 | .input_mux = &alc268_acer_dmic_capture_source, |
| 12870 | .unsol_event = alc268_acer_unsol_event, |
| 12871 | .init_hook = alc268_acer_init_hook, |
| 12872 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12873 | [ALC268_ACER_ASPIRE_ONE] = { |
| 12874 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12875 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12876 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12877 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12878 | alc268_acer_aspire_one_verbs }, |
| 12879 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12880 | .dac_nids = alc268_dac_nids, |
| 12881 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12882 | .adc_nids = alc268_adc_nids_alt, |
| 12883 | .capsrc_nids = alc268_capsrc_nids, |
| 12884 | .hp_nid = 0x03, |
| 12885 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12886 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12887 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12888 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12889 | .init_hook = alc268_acer_lc_init_hook, |
| 12890 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12891 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12892 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 12893 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12894 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12895 | alc268_dell_verbs }, |
| 12896 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12897 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12898 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12899 | .adc_nids = alc268_adc_nids_alt, |
| 12900 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12901 | .hp_nid = 0x02, |
| 12902 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12903 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12904 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12905 | .setup = alc268_dell_setup, |
| 12906 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12907 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12908 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12909 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12910 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12911 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12912 | alc268_toshiba_verbs }, |
| 12913 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12914 | .dac_nids = alc268_dac_nids, |
| 12915 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12916 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12917 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12918 | .hp_nid = 0x03, |
| 12919 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12920 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12921 | .channel_mode = alc268_modes, |
| 12922 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12923 | .setup = alc268_toshiba_setup, |
| 12924 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12925 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12926 | #ifdef CONFIG_SND_DEBUG |
| 12927 | [ALC268_TEST] = { |
| 12928 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 12929 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12930 | alc268_volume_init_verbs }, |
| 12931 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12932 | .dac_nids = alc268_dac_nids, |
| 12933 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12934 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12935 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12936 | .hp_nid = 0x03, |
| 12937 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12938 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12939 | .channel_mode = alc268_modes, |
| 12940 | .input_mux = &alc268_capture_source, |
| 12941 | }, |
| 12942 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12943 | }; |
| 12944 | |
| 12945 | static int patch_alc268(struct hda_codec *codec) |
| 12946 | { |
| 12947 | struct alc_spec *spec; |
| 12948 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12949 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12950 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 12951 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12952 | if (spec == NULL) |
| 12953 | return -ENOMEM; |
| 12954 | |
| 12955 | codec->spec = spec; |
| 12956 | |
| 12957 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 12958 | alc268_models, |
| 12959 | alc268_cfg_tbl); |
| 12960 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 12961 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 12962 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 12963 | ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
| 12964 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12965 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12966 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12967 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12968 | board_config = ALC268_AUTO; |
| 12969 | } |
| 12970 | |
| 12971 | if (board_config == ALC268_AUTO) { |
| 12972 | /* automatic parse from the BIOS config */ |
| 12973 | err = alc268_parse_auto_config(codec); |
| 12974 | if (err < 0) { |
| 12975 | alc_free(codec); |
| 12976 | return err; |
| 12977 | } else if (!err) { |
| 12978 | printk(KERN_INFO |
| 12979 | "hda_codec: Cannot set up configuration " |
| 12980 | "from BIOS. Using base mode...\n"); |
| 12981 | board_config = ALC268_3ST; |
| 12982 | } |
| 12983 | } |
| 12984 | |
| 12985 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12986 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12987 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12988 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 12989 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12990 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12991 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12992 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 12993 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12994 | has_beep = 0; |
| 12995 | for (i = 0; i < spec->num_mixers; i++) { |
| 12996 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 12997 | has_beep = 1; |
| 12998 | break; |
| 12999 | } |
| 13000 | } |
| 13001 | |
| 13002 | if (has_beep) { |
| 13003 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13004 | if (err < 0) { |
| 13005 | alc_free(codec); |
| 13006 | return err; |
| 13007 | } |
| 13008 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 13009 | /* override the amp caps for beep generator */ |
| 13010 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13011 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 13012 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 13013 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 13014 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13015 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13016 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13017 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13018 | /* check whether NID 0x07 is valid */ |
| 13019 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13020 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13021 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13022 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13023 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 13024 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13025 | if (spec->auto_mic || |
| 13026 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13027 | spec->adc_nids = alc268_adc_nids_alt; |
| 13028 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13029 | if (spec->auto_mic) |
| 13030 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13031 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 13032 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 13033 | else |
| 13034 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13035 | } else { |
| 13036 | spec->adc_nids = alc268_adc_nids; |
| 13037 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13038 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13039 | } |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13040 | /* set default input source */ |
| 13041 | for (i = 0; i < spec->num_adc_nids; i++) |
| 13042 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 13043 | 0, AC_VERB_SET_CONNECT_SEL, |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13044 | i < spec->num_mux_defs ? |
| 13045 | spec->input_mux[i].items[0].index : |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13046 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13047 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13048 | |
| 13049 | spec->vmaster_nid = 0x02; |
| 13050 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13051 | codec->patch_ops = alc_patch_ops; |
| 13052 | if (board_config == ALC268_AUTO) |
| 13053 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13054 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 13055 | codec->proc_widget_hook = print_realtek_coef; |
| 13056 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13057 | return 0; |
| 13058 | } |
| 13059 | |
| 13060 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13061 | * ALC269 channel source setting (2 channel) |
| 13062 | */ |
| 13063 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 13064 | |
| 13065 | #define alc269_dac_nids alc260_dac_nids |
| 13066 | |
| 13067 | static hda_nid_t alc269_adc_nids[1] = { |
| 13068 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13069 | 0x08, |
| 13070 | }; |
| 13071 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13072 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 13073 | 0x23, |
| 13074 | }; |
| 13075 | |
| 13076 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 13077 | * not a mux! |
| 13078 | */ |
| 13079 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13080 | #define alc269_modes alc260_modes |
| 13081 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 13082 | |
| 13083 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 13084 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13085 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13086 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13087 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13088 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13089 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13090 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13091 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13092 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13093 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13094 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13095 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 13096 | { } /* end */ |
| 13097 | }; |
| 13098 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13099 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 13100 | /* output mixer control */ |
| 13101 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13102 | { |
| 13103 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13104 | .name = "Master Playback Switch", |
| 13105 | .info = snd_hda_mixer_amp_switch_info, |
| 13106 | .get = snd_hda_mixer_amp_switch_get, |
| 13107 | .put = alc268_acer_master_sw_put, |
| 13108 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13109 | }, |
| 13110 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13111 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13112 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13113 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13114 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13115 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13116 | { } |
| 13117 | }; |
| 13118 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13119 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 13120 | /* output mixer control */ |
| 13121 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13122 | { |
| 13123 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13124 | .name = "Master Playback Switch", |
| 13125 | .info = snd_hda_mixer_amp_switch_info, |
| 13126 | .get = snd_hda_mixer_amp_switch_get, |
| 13127 | .put = alc268_acer_master_sw_put, |
| 13128 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13129 | }, |
| 13130 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13131 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13132 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13133 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13134 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13135 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 13136 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 13137 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 13138 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13139 | { } |
| 13140 | }; |
| 13141 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13142 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13143 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13144 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13145 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13146 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13147 | { } /* end */ |
| 13148 | }; |
| 13149 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13150 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13151 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 13152 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13153 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13154 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13155 | { } /* end */ |
| 13156 | }; |
| 13157 | |
| 13158 | /* FSC amilo */ |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13159 | #define alc269_fujitsu_mixer alc269_eeepc_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13160 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13161 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 13162 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13163 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13164 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13165 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13166 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13167 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13168 | { } |
| 13169 | }; |
| 13170 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13171 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 13172 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13173 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13174 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13175 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13176 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13177 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13178 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13179 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13180 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13181 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13182 | { } |
| 13183 | }; |
| 13184 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13185 | /* toggle speaker-output according to the hp-jack state */ |
| 13186 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 13187 | { |
| 13188 | unsigned int present; |
| 13189 | unsigned char bits; |
| 13190 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13191 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13192 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 13193 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 13194 | AMP_IN_MUTE(0), bits); |
| 13195 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 13196 | AMP_IN_MUTE(0), bits); |
| 13197 | |
| 13198 | snd_hda_codec_write(codec, 0x20, 0, |
| 13199 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13200 | snd_hda_codec_write(codec, 0x20, 0, |
| 13201 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13202 | |
| 13203 | snd_hda_codec_write(codec, 0x20, 0, |
| 13204 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13205 | snd_hda_codec_write(codec, 0x20, 0, |
| 13206 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13207 | } |
| 13208 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13209 | /* toggle speaker-output according to the hp-jacks state */ |
| 13210 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 13211 | { |
| 13212 | unsigned int present; |
| 13213 | unsigned char bits; |
| 13214 | |
| 13215 | /* Check laptop headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13216 | present = snd_hda_jack_detect(codec, 0x15); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13217 | |
| 13218 | /* Check port replicator headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13219 | present |= snd_hda_jack_detect(codec, 0x1a); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13220 | |
| 13221 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 13222 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 13223 | AMP_IN_MUTE(0), bits); |
| 13224 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 13225 | AMP_IN_MUTE(0), bits); |
| 13226 | |
| 13227 | snd_hda_codec_write(codec, 0x20, 0, |
| 13228 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13229 | snd_hda_codec_write(codec, 0x20, 0, |
| 13230 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13231 | |
| 13232 | snd_hda_codec_write(codec, 0x20, 0, |
| 13233 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13234 | snd_hda_codec_write(codec, 0x20, 0, |
| 13235 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13236 | } |
| 13237 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13238 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 13239 | { |
| 13240 | unsigned int present_laptop; |
| 13241 | unsigned int present_dock; |
| 13242 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13243 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 13244 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13245 | |
| 13246 | /* Laptop mic port overrides dock mic port, design decision */ |
| 13247 | if (present_dock) |
| 13248 | snd_hda_codec_write(codec, 0x23, 0, |
| 13249 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 13250 | if (present_laptop) |
| 13251 | snd_hda_codec_write(codec, 0x23, 0, |
| 13252 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 13253 | if (!present_dock && !present_laptop) |
| 13254 | snd_hda_codec_write(codec, 0x23, 0, |
| 13255 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 13256 | } |
| 13257 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13258 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 13259 | unsigned int res) |
| 13260 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13261 | switch (res >> 26) { |
| 13262 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13263 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13264 | break; |
| 13265 | case ALC880_MIC_EVENT: |
| 13266 | alc_mic_automute(codec); |
| 13267 | break; |
| 13268 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13269 | } |
| 13270 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13271 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 13272 | unsigned int res) |
| 13273 | { |
| 13274 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13275 | alc269_lifebook_speaker_automute(codec); |
| 13276 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13277 | alc269_lifebook_mic_autoswitch(codec); |
| 13278 | } |
| 13279 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13280 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 13281 | { |
| 13282 | struct alc_spec *spec = codec->spec; |
| 13283 | spec->ext_mic.pin = 0x18; |
| 13284 | spec->ext_mic.mux_idx = 0; |
| 13285 | spec->int_mic.pin = 0x19; |
| 13286 | spec->int_mic.mux_idx = 1; |
| 13287 | spec->auto_mic = 1; |
| 13288 | } |
| 13289 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13290 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 13291 | { |
| 13292 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13293 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13294 | } |
| 13295 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13296 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 13297 | { |
| 13298 | alc269_lifebook_speaker_automute(codec); |
| 13299 | alc269_lifebook_mic_autoswitch(codec); |
| 13300 | } |
| 13301 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13302 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 13303 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13304 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 13305 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13306 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13307 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13308 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13309 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13310 | {} |
| 13311 | }; |
| 13312 | |
| 13313 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 13314 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13315 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13316 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13317 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 13318 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13319 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13320 | {} |
| 13321 | }; |
| 13322 | |
| 13323 | /* toggle speaker-output according to the hp-jack state */ |
| 13324 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 13325 | { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13326 | struct alc_spec *spec = codec->spec; |
| 13327 | unsigned int nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13328 | unsigned int present; |
| 13329 | unsigned char bits; |
| 13330 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13331 | present = snd_hda_jack_detect(codec, nid); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13332 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 13333 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 13334 | AMP_IN_MUTE(0), bits); |
| 13335 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 13336 | AMP_IN_MUTE(0), bits); |
| 13337 | } |
| 13338 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13339 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13340 | static void alc269_eeepc_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13341 | unsigned int res) |
| 13342 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13343 | switch (res >> 26) { |
| 13344 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13345 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13346 | break; |
| 13347 | case ALC880_MIC_EVENT: |
| 13348 | alc_mic_automute(codec); |
| 13349 | break; |
| 13350 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13351 | } |
| 13352 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13353 | static void alc269_eeepc_dmic_setup(struct hda_codec *codec) |
| 13354 | { |
| 13355 | struct alc_spec *spec = codec->spec; |
| 13356 | spec->ext_mic.pin = 0x18; |
| 13357 | spec->ext_mic.mux_idx = 0; |
| 13358 | spec->int_mic.pin = 0x12; |
| 13359 | spec->int_mic.mux_idx = 5; |
| 13360 | spec->auto_mic = 1; |
| 13361 | } |
| 13362 | |
| 13363 | static void alc269_eeepc_amic_setup(struct hda_codec *codec) |
| 13364 | { |
| 13365 | struct alc_spec *spec = codec->spec; |
| 13366 | spec->ext_mic.pin = 0x18; |
| 13367 | spec->ext_mic.mux_idx = 0; |
| 13368 | spec->int_mic.pin = 0x19; |
| 13369 | spec->int_mic.mux_idx = 1; |
| 13370 | spec->auto_mic = 1; |
| 13371 | } |
| 13372 | |
| 13373 | static void alc269_eeepc_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13374 | { |
| 13375 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13376 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13377 | } |
| 13378 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13379 | /* |
| 13380 | * generic initialization of ADC, input mixers and output mixers |
| 13381 | */ |
| 13382 | static struct hda_verb alc269_init_verbs[] = { |
| 13383 | /* |
| 13384 | * Unmute ADC0 and set the default input to mic-in |
| 13385 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13386 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13387 | |
| 13388 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 13389 | * analog-loopback mixer widget |
| 13390 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 13391 | * front panel mic (mic 2) |
| 13392 | */ |
| 13393 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 13394 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13395 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13396 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13397 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13398 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 13399 | |
| 13400 | /* |
| 13401 | * Set up output mixers (0x0c - 0x0e) |
| 13402 | */ |
| 13403 | /* set vol=0 to output mixers */ |
| 13404 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13405 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13406 | |
| 13407 | /* set up input amps for analog loopback */ |
| 13408 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 13409 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13410 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13411 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13412 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13413 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13414 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13415 | |
| 13416 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13417 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13418 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13419 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13420 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13421 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13422 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13423 | |
| 13424 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13425 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13426 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13427 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13428 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13429 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13430 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13431 | |
| 13432 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13433 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13434 | |
| 13435 | /* FIXME: use matrix-type input source selection */ |
| 13436 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 13437 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13438 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13439 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13440 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13441 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13442 | |
| 13443 | /* set EAPD */ |
| 13444 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13445 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13446 | { } |
| 13447 | }; |
| 13448 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 13449 | #define alc269_auto_create_multi_out_ctls \ |
| 13450 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13451 | #define alc269_auto_create_input_ctls \ |
| 13452 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13453 | |
| 13454 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13455 | #define alc269_loopbacks alc880_loopbacks |
| 13456 | #endif |
| 13457 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13458 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13459 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 13460 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 13461 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 13462 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 13463 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13464 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 13465 | .substreams = 1, |
| 13466 | .channels_min = 2, |
| 13467 | .channels_max = 8, |
| 13468 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13469 | /* NID is set in alc_build_pcms */ |
| 13470 | .ops = { |
| 13471 | .open = alc880_playback_pcm_open, |
| 13472 | .prepare = alc880_playback_pcm_prepare, |
| 13473 | .cleanup = alc880_playback_pcm_cleanup |
| 13474 | }, |
| 13475 | }; |
| 13476 | |
| 13477 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 13478 | .substreams = 1, |
| 13479 | .channels_min = 2, |
| 13480 | .channels_max = 2, |
| 13481 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13482 | /* NID is set in alc_build_pcms */ |
| 13483 | }; |
| 13484 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13485 | /* |
| 13486 | * BIOS auto configuration |
| 13487 | */ |
| 13488 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 13489 | { |
| 13490 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 13491 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13492 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 13493 | |
| 13494 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13495 | alc269_ignore); |
| 13496 | if (err < 0) |
| 13497 | return err; |
| 13498 | |
| 13499 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13500 | if (err < 0) |
| 13501 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13502 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13503 | if (err < 0) |
| 13504 | return err; |
| 13505 | |
| 13506 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13507 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 13508 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13509 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 13510 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13511 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13512 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13513 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13514 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13515 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13516 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13517 | /* set default input source */ |
| 13518 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 13519 | 0, AC_VERB_SET_CONNECT_SEL, |
| 13520 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13521 | |
| 13522 | err = alc_auto_add_mic_boost(codec); |
| 13523 | if (err < 0) |
| 13524 | return err; |
| 13525 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13526 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 13527 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13528 | |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13529 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 13530 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13531 | return 1; |
| 13532 | } |
| 13533 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13534 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 13535 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13536 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 13537 | |
| 13538 | |
| 13539 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13540 | static void alc269_auto_init(struct hda_codec *codec) |
| 13541 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13542 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13543 | alc269_auto_init_multi_out(codec); |
| 13544 | alc269_auto_init_hp_out(codec); |
| 13545 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13546 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13547 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13548 | } |
| 13549 | |
| 13550 | /* |
| 13551 | * configuration and preset |
| 13552 | */ |
| 13553 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13554 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 13555 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13556 | [ALC269_ASUS_AMIC] = "asus-amic", |
| 13557 | [ALC269_ASUS_DMIC] = "asus-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13558 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 13559 | [ALC269_LIFEBOOK] = "lifebook", |
| 13560 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13561 | }; |
| 13562 | |
| 13563 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13564 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13565 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13566 | ALC269_ASUS_AMIC), |
| 13567 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_ASUS_AMIC), |
| 13568 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80JT", ALC269_ASUS_AMIC), |
| 13569 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_ASUS_AMIC), |
| 13570 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_ASUS_AMIC), |
| 13571 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_ASUS_AMIC), |
| 13572 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_ASUS_AMIC), |
| 13573 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_ASUS_AMIC), |
| 13574 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_ASUS_AMIC), |
| 13575 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_ASUS_AMIC), |
| 13576 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_ASUS_AMIC), |
| 13577 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_ASUS_AMIC), |
| 13578 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_ASUS_AMIC), |
| 13579 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_ASUS_AMIC), |
| 13580 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_ASUS_AMIC), |
| 13581 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_ASUS_AMIC), |
| 13582 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_ASUS_AMIC), |
| 13583 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_ASUS_AMIC), |
| 13584 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_ASUS_AMIC), |
| 13585 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_ASUS_AMIC), |
| 13586 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_ASUS_AMIC), |
| 13587 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_AMIC), |
| 13588 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_ASUS_AMIC), |
| 13589 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_AMIC), |
| 13590 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_DMIC), |
| 13591 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_AMIC), |
| 13592 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_AMIC), |
| 13593 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_AMIC), |
| 13594 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13595 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13596 | ALC269_ASUS_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13597 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13598 | ALC269_ASUS_DMIC), |
| 13599 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_ASUS_DMIC), |
| 13600 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_ASUS_DMIC), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13601 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13602 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13603 | {} |
| 13604 | }; |
| 13605 | |
| 13606 | static struct alc_config_preset alc269_presets[] = { |
| 13607 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13608 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13609 | .init_verbs = { alc269_init_verbs }, |
| 13610 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13611 | .dac_nids = alc269_dac_nids, |
| 13612 | .hp_nid = 0x03, |
| 13613 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13614 | .channel_mode = alc269_modes, |
| 13615 | .input_mux = &alc269_capture_source, |
| 13616 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13617 | [ALC269_QUANTA_FL1] = { |
| 13618 | .mixers = { alc269_quanta_fl1_mixer }, |
| 13619 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 13620 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13621 | .dac_nids = alc269_dac_nids, |
| 13622 | .hp_nid = 0x03, |
| 13623 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13624 | .channel_mode = alc269_modes, |
| 13625 | .input_mux = &alc269_capture_source, |
| 13626 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13627 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13628 | .init_hook = alc269_quanta_fl1_init_hook, |
| 13629 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13630 | [ALC269_ASUS_AMIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13631 | .mixers = { alc269_eeepc_mixer }, |
| 13632 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13633 | .init_verbs = { alc269_init_verbs, |
| 13634 | alc269_eeepc_amic_init_verbs }, |
| 13635 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13636 | .dac_nids = alc269_dac_nids, |
| 13637 | .hp_nid = 0x03, |
| 13638 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13639 | .channel_mode = alc269_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13640 | .unsol_event = alc269_eeepc_unsol_event, |
| 13641 | .setup = alc269_eeepc_amic_setup, |
| 13642 | .init_hook = alc269_eeepc_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13643 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13644 | [ALC269_ASUS_DMIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13645 | .mixers = { alc269_eeepc_mixer }, |
| 13646 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13647 | .init_verbs = { alc269_init_verbs, |
| 13648 | alc269_eeepc_dmic_init_verbs }, |
| 13649 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13650 | .dac_nids = alc269_dac_nids, |
| 13651 | .hp_nid = 0x03, |
| 13652 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13653 | .channel_mode = alc269_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13654 | .unsol_event = alc269_eeepc_unsol_event, |
| 13655 | .setup = alc269_eeepc_dmic_setup, |
| 13656 | .init_hook = alc269_eeepc_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13657 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13658 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13659 | .mixers = { alc269_fujitsu_mixer }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13660 | .cap_mixer = alc269_epc_capture_mixer, |
| 13661 | .init_verbs = { alc269_init_verbs, |
| 13662 | alc269_eeepc_dmic_init_verbs }, |
| 13663 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13664 | .dac_nids = alc269_dac_nids, |
| 13665 | .hp_nid = 0x03, |
| 13666 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13667 | .channel_mode = alc269_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13668 | .unsol_event = alc269_eeepc_unsol_event, |
| 13669 | .setup = alc269_eeepc_dmic_setup, |
| 13670 | .init_hook = alc269_eeepc_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13671 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13672 | [ALC269_LIFEBOOK] = { |
| 13673 | .mixers = { alc269_lifebook_mixer }, |
| 13674 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 13675 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13676 | .dac_nids = alc269_dac_nids, |
| 13677 | .hp_nid = 0x03, |
| 13678 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13679 | .channel_mode = alc269_modes, |
| 13680 | .input_mux = &alc269_capture_source, |
| 13681 | .unsol_event = alc269_lifebook_unsol_event, |
| 13682 | .init_hook = alc269_lifebook_init_hook, |
| 13683 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13684 | }; |
| 13685 | |
| 13686 | static int patch_alc269(struct hda_codec *codec) |
| 13687 | { |
| 13688 | struct alc_spec *spec; |
| 13689 | int board_config; |
| 13690 | int err; |
| 13691 | |
| 13692 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13693 | if (spec == NULL) |
| 13694 | return -ENOMEM; |
| 13695 | |
| 13696 | codec->spec = spec; |
| 13697 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 13698 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 13699 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 13700 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ |
| 13701 | kfree(codec->chip_name); |
| 13702 | codec->chip_name = kstrdup("ALC259", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 13703 | if (!codec->chip_name) { |
| 13704 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 13705 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 13706 | } |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 13707 | } |
| 13708 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13709 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 13710 | alc269_models, |
| 13711 | alc269_cfg_tbl); |
| 13712 | |
| 13713 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13714 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13715 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13716 | board_config = ALC269_AUTO; |
| 13717 | } |
| 13718 | |
| 13719 | if (board_config == ALC269_AUTO) { |
| 13720 | /* automatic parse from the BIOS config */ |
| 13721 | err = alc269_parse_auto_config(codec); |
| 13722 | if (err < 0) { |
| 13723 | alc_free(codec); |
| 13724 | return err; |
| 13725 | } else if (!err) { |
| 13726 | printk(KERN_INFO |
| 13727 | "hda_codec: Cannot set up configuration " |
| 13728 | "from BIOS. Using base mode...\n"); |
| 13729 | board_config = ALC269_BASIC; |
| 13730 | } |
| 13731 | } |
| 13732 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 13733 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13734 | if (err < 0) { |
| 13735 | alc_free(codec); |
| 13736 | return err; |
| 13737 | } |
| 13738 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13739 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 13740 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13741 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13742 | if (codec->subsystem_id == 0x17aa3bf8) { |
| 13743 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 13744 | * fix the sample rate of analog I/O to 44.1kHz |
| 13745 | */ |
| 13746 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 13747 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
| 13748 | } else { |
| 13749 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 13750 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 13751 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13752 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 13753 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 13754 | |
| 13755 | spec->adc_nids = alc269_adc_nids; |
| 13756 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13757 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13758 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 13759 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13760 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13761 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 13762 | spec->vmaster_nid = 0x02; |
| 13763 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13764 | codec->patch_ops = alc_patch_ops; |
| 13765 | if (board_config == ALC269_AUTO) |
| 13766 | spec->init_hook = alc269_auto_init; |
| 13767 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13768 | if (!spec->loopback.amplist) |
| 13769 | spec->loopback.amplist = alc269_loopbacks; |
| 13770 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 13771 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13772 | |
| 13773 | return 0; |
| 13774 | } |
| 13775 | |
| 13776 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13777 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 13778 | */ |
| 13779 | |
| 13780 | /* |
| 13781 | * set the path ways for 2 channel output |
| 13782 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 13783 | */ |
| 13784 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 13785 | /* set pin widget 1Ah (line in) for input */ |
| 13786 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13787 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13788 | * the vref |
| 13789 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13790 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13791 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13792 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13793 | #if 0 |
| 13794 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13795 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13796 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13797 | { } /* end */ |
| 13798 | }; |
| 13799 | /* |
| 13800 | * 6ch mode |
| 13801 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 13802 | */ |
| 13803 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 13804 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13805 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13806 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13807 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13808 | |
| 13809 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13810 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13811 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13812 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13813 | #if 0 |
| 13814 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13815 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13816 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13817 | { } /* end */ |
| 13818 | }; |
| 13819 | |
| 13820 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 13821 | { 2, alc861_threestack_ch2_init }, |
| 13822 | { 6, alc861_threestack_ch6_init }, |
| 13823 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13824 | /* Set mic1 as input and unmute the mixer */ |
| 13825 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 13826 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13827 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13828 | { } /* end */ |
| 13829 | }; |
| 13830 | /* Set mic1 as output and mute mixer */ |
| 13831 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 13832 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13833 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13834 | { } /* end */ |
| 13835 | }; |
| 13836 | |
| 13837 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 13838 | { 2, alc861_uniwill_m31_ch2_init }, |
| 13839 | { 4, alc861_uniwill_m31_ch4_init }, |
| 13840 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13841 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13842 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 13843 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 13844 | /* set pin widget 1Ah (line in) for input */ |
| 13845 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13846 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13847 | * the vref |
| 13848 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13849 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13850 | |
| 13851 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13852 | #if 0 |
| 13853 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13854 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13855 | #endif |
| 13856 | { } /* end */ |
| 13857 | }; |
| 13858 | /* Set mic1 nad line-in as output and mute mixer */ |
| 13859 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 13860 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13861 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13862 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13863 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13864 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13865 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13866 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13867 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13868 | |
| 13869 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13870 | #if 0 |
| 13871 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13872 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13873 | #endif |
| 13874 | { } /* end */ |
| 13875 | }; |
| 13876 | |
| 13877 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 13878 | { 2, alc861_asus_ch2_init }, |
| 13879 | { 6, alc861_asus_ch6_init }, |
| 13880 | }; |
| 13881 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13882 | /* patch-ALC861 */ |
| 13883 | |
| 13884 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 13885 | /* output mixer control */ |
| 13886 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13887 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13888 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13889 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13890 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13891 | |
| 13892 | /*Input mixer control */ |
| 13893 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13894 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13895 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13896 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13897 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13898 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13899 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13900 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13901 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13902 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13903 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13904 | { } /* end */ |
| 13905 | }; |
| 13906 | |
| 13907 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 13908 | /* output mixer control */ |
| 13909 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13910 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13911 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13912 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13913 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13914 | |
| 13915 | /* Input mixer control */ |
| 13916 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13917 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13918 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13919 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13920 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13921 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13922 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13923 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13924 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13925 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13926 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13927 | { |
| 13928 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13929 | .name = "Channel Mode", |
| 13930 | .info = alc_ch_mode_info, |
| 13931 | .get = alc_ch_mode_get, |
| 13932 | .put = alc_ch_mode_put, |
| 13933 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 13934 | }, |
| 13935 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13936 | }; |
| 13937 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13938 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13939 | /* output mixer control */ |
| 13940 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13941 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13942 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13943 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13944 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13945 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13946 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13947 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 13948 | /* output mixer control */ |
| 13949 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13950 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13951 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13952 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13953 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13954 | |
| 13955 | /* Input mixer control */ |
| 13956 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13957 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13958 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13959 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13960 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13961 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13962 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13963 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13964 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13965 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13966 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13967 | { |
| 13968 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13969 | .name = "Channel Mode", |
| 13970 | .info = alc_ch_mode_info, |
| 13971 | .get = alc_ch_mode_get, |
| 13972 | .put = alc_ch_mode_put, |
| 13973 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13974 | }, |
| 13975 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13976 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13977 | |
| 13978 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 13979 | /* output mixer control */ |
| 13980 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13981 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13982 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13983 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13984 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13985 | |
| 13986 | /* Input mixer control */ |
| 13987 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13988 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13989 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13990 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13991 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13992 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13993 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13994 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13995 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13996 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 13997 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13998 | { |
| 13999 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14000 | .name = "Channel Mode", |
| 14001 | .info = alc_ch_mode_info, |
| 14002 | .get = alc_ch_mode_get, |
| 14003 | .put = alc_ch_mode_put, |
| 14004 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 14005 | }, |
| 14006 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14007 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14008 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14009 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 14010 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14011 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14012 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14013 | { } |
| 14014 | }; |
| 14015 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14016 | /* |
| 14017 | * generic initialization of ADC, input mixers and output mixers |
| 14018 | */ |
| 14019 | static struct hda_verb alc861_base_init_verbs[] = { |
| 14020 | /* |
| 14021 | * Unmute ADC0 and set the default input to mic-in |
| 14022 | */ |
| 14023 | /* port-A for surround (rear panel) */ |
| 14024 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14025 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14026 | /* port-B for mic-in (rear panel) with vref */ |
| 14027 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14028 | /* port-C for line-in (rear panel) */ |
| 14029 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14030 | /* port-D for Front */ |
| 14031 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14032 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14033 | /* port-E for HP out (front panel) */ |
| 14034 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 14035 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14036 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14037 | /* port-F for mic-in (front panel) with vref */ |
| 14038 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14039 | /* port-G for CLFE (rear panel) */ |
| 14040 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14041 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14042 | /* port-H for side (rear panel) */ |
| 14043 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14044 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14045 | /* CD-in */ |
| 14046 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14047 | /* route front mic to ADC1*/ |
| 14048 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14049 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14050 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14051 | /* Unmute DAC0~3 & spdif out*/ |
| 14052 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14053 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14054 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14055 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14056 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14057 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14058 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14059 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14060 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14061 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14062 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14063 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14064 | /* Unmute Stereo Mixer 15 */ |
| 14065 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14066 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14067 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14068 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14069 | |
| 14070 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14071 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14072 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14073 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14074 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14075 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14076 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14077 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14078 | /* hp used DAC 3 (Front) */ |
| 14079 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14080 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14081 | |
| 14082 | { } |
| 14083 | }; |
| 14084 | |
| 14085 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 14086 | /* |
| 14087 | * Unmute ADC0 and set the default input to mic-in |
| 14088 | */ |
| 14089 | /* port-A for surround (rear panel) */ |
| 14090 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14091 | /* port-B for mic-in (rear panel) with vref */ |
| 14092 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14093 | /* port-C for line-in (rear panel) */ |
| 14094 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14095 | /* port-D for Front */ |
| 14096 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14097 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14098 | /* port-E for HP out (front panel) */ |
| 14099 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 14100 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14101 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14102 | /* port-F for mic-in (front panel) with vref */ |
| 14103 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14104 | /* port-G for CLFE (rear panel) */ |
| 14105 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14106 | /* port-H for side (rear panel) */ |
| 14107 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14108 | /* CD-in */ |
| 14109 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14110 | /* route front mic to ADC1*/ |
| 14111 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14112 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14113 | /* Unmute DAC0~3 & spdif out*/ |
| 14114 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14115 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14116 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14117 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14118 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14119 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14120 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14121 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14122 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14123 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14124 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14125 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14126 | /* Unmute Stereo Mixer 15 */ |
| 14127 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14128 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14129 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14130 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14131 | |
| 14132 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14133 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14134 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14135 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14136 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14137 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14138 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14139 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14140 | /* hp used DAC 3 (Front) */ |
| 14141 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14142 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14143 | { } |
| 14144 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14145 | |
| 14146 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 14147 | /* |
| 14148 | * Unmute ADC0 and set the default input to mic-in |
| 14149 | */ |
| 14150 | /* port-A for surround (rear panel) */ |
| 14151 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14152 | /* port-B for mic-in (rear panel) with vref */ |
| 14153 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14154 | /* port-C for line-in (rear panel) */ |
| 14155 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14156 | /* port-D for Front */ |
| 14157 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14158 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14159 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14160 | /* this has to be set to VREF80 */ |
| 14161 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14162 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14163 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14164 | /* port-F for mic-in (front panel) with vref */ |
| 14165 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14166 | /* port-G for CLFE (rear panel) */ |
| 14167 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14168 | /* port-H for side (rear panel) */ |
| 14169 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14170 | /* CD-in */ |
| 14171 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14172 | /* route front mic to ADC1*/ |
| 14173 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14174 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14175 | /* Unmute DAC0~3 & spdif out*/ |
| 14176 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14177 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14178 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14179 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14180 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14181 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14182 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14183 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14184 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14185 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14186 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14187 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14188 | /* Unmute Stereo Mixer 15 */ |
| 14189 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14190 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14191 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14192 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14193 | |
| 14194 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14195 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14196 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14197 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14198 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14199 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14200 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14201 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14202 | /* hp used DAC 3 (Front) */ |
| 14203 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14204 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14205 | { } |
| 14206 | }; |
| 14207 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14208 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 14209 | /* |
| 14210 | * Unmute ADC0 and set the default input to mic-in |
| 14211 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14212 | /* port-A for surround (rear panel) |
| 14213 | * according to codec#0 this is the HP jack |
| 14214 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14215 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 14216 | /* route front PCM to HP */ |
| 14217 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 14218 | /* port-B for mic-in (rear panel) with vref */ |
| 14219 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14220 | /* port-C for line-in (rear panel) */ |
| 14221 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14222 | /* port-D for Front */ |
| 14223 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14224 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14225 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14226 | /* this has to be set to VREF80 */ |
| 14227 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14228 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14229 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14230 | /* port-F for mic-in (front panel) with vref */ |
| 14231 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14232 | /* port-G for CLFE (rear panel) */ |
| 14233 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14234 | /* port-H for side (rear panel) */ |
| 14235 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14236 | /* CD-in */ |
| 14237 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14238 | /* route front mic to ADC1*/ |
| 14239 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14240 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14241 | /* Unmute DAC0~3 & spdif out*/ |
| 14242 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14243 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14244 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14245 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14246 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14247 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14248 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14249 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14250 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14251 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14252 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14253 | /* Unmute Stereo Mixer 15 */ |
| 14254 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14255 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14256 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14257 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14258 | |
| 14259 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14260 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14261 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14262 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14263 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14264 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14265 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14266 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14267 | /* hp used DAC 3 (Front) */ |
| 14268 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14269 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14270 | { } |
| 14271 | }; |
| 14272 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14273 | /* additional init verbs for ASUS laptops */ |
| 14274 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 14275 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 14276 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 14277 | { } |
| 14278 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14279 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14280 | /* |
| 14281 | * generic initialization of ADC, input mixers and output mixers |
| 14282 | */ |
| 14283 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 14284 | /* |
| 14285 | * Unmute ADC0 and set the default input to mic-in |
| 14286 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14287 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14288 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14289 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14290 | /* Unmute DAC0~3 & spdif out*/ |
| 14291 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14292 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14293 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14294 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14295 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14296 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14297 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14298 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14299 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14300 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14301 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14302 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14303 | /* Unmute Stereo Mixer 15 */ |
| 14304 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14305 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14306 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14307 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 14308 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14309 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14310 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14311 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14312 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14313 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14314 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14315 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14316 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14317 | |
| 14318 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14319 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14320 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14321 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14322 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14323 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14324 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14325 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14326 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14327 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14328 | |
| 14329 | { } |
| 14330 | }; |
| 14331 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14332 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 14333 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14334 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14335 | { } |
| 14336 | }; |
| 14337 | |
| 14338 | /* toggle speaker-output according to the hp-jack state */ |
| 14339 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 14340 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14341 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14342 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14343 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 14344 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 14345 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 14346 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14347 | } |
| 14348 | |
| 14349 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 14350 | unsigned int res) |
| 14351 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14352 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14353 | alc861_toshiba_automute(codec); |
| 14354 | } |
| 14355 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14356 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14357 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 14358 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 14359 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 14360 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 14361 | |
| 14362 | |
| 14363 | #define ALC861_DIGOUT_NID 0x07 |
| 14364 | |
| 14365 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 14366 | { 8, NULL } |
| 14367 | }; |
| 14368 | |
| 14369 | static hda_nid_t alc861_dac_nids[4] = { |
| 14370 | /* front, surround, clfe, side */ |
| 14371 | 0x03, 0x06, 0x05, 0x04 |
| 14372 | }; |
| 14373 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14374 | static hda_nid_t alc660_dac_nids[3] = { |
| 14375 | /* front, clfe, surround */ |
| 14376 | 0x03, 0x05, 0x06 |
| 14377 | }; |
| 14378 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14379 | static hda_nid_t alc861_adc_nids[1] = { |
| 14380 | /* ADC0-2 */ |
| 14381 | 0x08, |
| 14382 | }; |
| 14383 | |
| 14384 | static struct hda_input_mux alc861_capture_source = { |
| 14385 | .num_items = 5, |
| 14386 | .items = { |
| 14387 | { "Mic", 0x0 }, |
| 14388 | { "Front Mic", 0x3 }, |
| 14389 | { "Line", 0x1 }, |
| 14390 | { "CD", 0x4 }, |
| 14391 | { "Mixer", 0x5 }, |
| 14392 | }, |
| 14393 | }; |
| 14394 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14395 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 14396 | { |
| 14397 | struct alc_spec *spec = codec->spec; |
| 14398 | hda_nid_t mix, srcs[5]; |
| 14399 | int i, j, num; |
| 14400 | |
| 14401 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 14402 | return 0; |
| 14403 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 14404 | if (num < 0) |
| 14405 | return 0; |
| 14406 | for (i = 0; i < num; i++) { |
| 14407 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 14408 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14409 | if (type != AC_WID_AUD_OUT) |
| 14410 | continue; |
| 14411 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 14412 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 14413 | break; |
| 14414 | if (j >= spec->multiout.num_dacs) |
| 14415 | return srcs[i]; |
| 14416 | } |
| 14417 | return 0; |
| 14418 | } |
| 14419 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14420 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14421 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14422 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14423 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14424 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14425 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14426 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14427 | |
| 14428 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 14429 | for (i = 0; i < cfg->line_outs; i++) { |
| 14430 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14431 | dac = alc861_look_for_dac(codec, nid); |
| 14432 | if (!dac) |
| 14433 | continue; |
| 14434 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14435 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14436 | return 0; |
| 14437 | } |
| 14438 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14439 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 14440 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14441 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 14442 | return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14443 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 14444 | } |
| 14445 | |
| 14446 | /* add playback controls from the parsed DAC table */ |
| 14447 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 14448 | const struct auto_pin_cfg *cfg) |
| 14449 | { |
| 14450 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14451 | static const char *chname[4] = { |
| 14452 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 14453 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14454 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14455 | int i, err; |
| 14456 | |
| 14457 | if (cfg->line_outs == 1) { |
| 14458 | const char *pfx = NULL; |
| 14459 | if (!cfg->hp_outs) |
| 14460 | pfx = "Master"; |
| 14461 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 14462 | pfx = "Speaker"; |
| 14463 | if (pfx) { |
| 14464 | nid = spec->multiout.dac_nids[0]; |
| 14465 | return alc861_create_out_sw(codec, pfx, nid, 3); |
| 14466 | } |
| 14467 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14468 | |
| 14469 | for (i = 0; i < cfg->line_outs; i++) { |
| 14470 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14471 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14472 | continue; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14473 | if (i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14474 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14475 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14476 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14477 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14478 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14479 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14480 | return err; |
| 14481 | } else { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14482 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14483 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14484 | return err; |
| 14485 | } |
| 14486 | } |
| 14487 | return 0; |
| 14488 | } |
| 14489 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14490 | 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] | 14491 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14492 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14493 | int err; |
| 14494 | hda_nid_t nid; |
| 14495 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14496 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14497 | return 0; |
| 14498 | |
| 14499 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14500 | nid = alc861_look_for_dac(codec, pin); |
| 14501 | if (nid) { |
| 14502 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 14503 | if (err < 0) |
| 14504 | return err; |
| 14505 | spec->multiout.hp_nid = nid; |
| 14506 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14507 | } |
| 14508 | return 0; |
| 14509 | } |
| 14510 | |
| 14511 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14512 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14513 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14514 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14515 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14516 | } |
| 14517 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14518 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14519 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14520 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14521 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14522 | hda_nid_t mix, srcs[5]; |
| 14523 | int i, num; |
| 14524 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 14525 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14526 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14527 | 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] | 14528 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14529 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 14530 | return; |
| 14531 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 14532 | if (num < 0) |
| 14533 | return; |
| 14534 | for (i = 0; i < num; i++) { |
| 14535 | unsigned int mute; |
| 14536 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 14537 | mute = AMP_IN_UNMUTE(i); |
| 14538 | else |
| 14539 | mute = AMP_IN_MUTE(i); |
| 14540 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14541 | mute); |
| 14542 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14543 | } |
| 14544 | |
| 14545 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 14546 | { |
| 14547 | struct alc_spec *spec = codec->spec; |
| 14548 | int i; |
| 14549 | |
| 14550 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 14551 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14552 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14553 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14554 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14555 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14556 | } |
| 14557 | } |
| 14558 | |
| 14559 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 14560 | { |
| 14561 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14562 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 14563 | if (spec->autocfg.hp_outs) |
| 14564 | alc861_auto_set_output_and_unmute(codec, |
| 14565 | spec->autocfg.hp_pins[0], |
| 14566 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14567 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 14568 | if (spec->autocfg.speaker_outs) |
| 14569 | alc861_auto_set_output_and_unmute(codec, |
| 14570 | spec->autocfg.speaker_pins[0], |
| 14571 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14572 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14573 | } |
| 14574 | |
| 14575 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 14576 | { |
| 14577 | struct alc_spec *spec = codec->spec; |
| 14578 | int i; |
| 14579 | |
| 14580 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14581 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 14582 | if (nid >= 0x0c && nid <= 0x11) |
| 14583 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14584 | } |
| 14585 | } |
| 14586 | |
| 14587 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14588 | /* return 1 if successful, 0 if the proper config is not found, |
| 14589 | * or a negative error code |
| 14590 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14591 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 14592 | { |
| 14593 | struct alc_spec *spec = codec->spec; |
| 14594 | int err; |
| 14595 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 14596 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14597 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14598 | alc861_ignore); |
| 14599 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14600 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14601 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14602 | return 0; /* can't find valid BIOS pin config */ |
| 14603 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14604 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14605 | if (err < 0) |
| 14606 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14607 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14608 | if (err < 0) |
| 14609 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14610 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14611 | if (err < 0) |
| 14612 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14613 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14614 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14615 | return err; |
| 14616 | |
| 14617 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14618 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14619 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14620 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 14621 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14622 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14623 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14624 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14625 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14626 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 14627 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14628 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14629 | |
| 14630 | spec->adc_nids = alc861_adc_nids; |
| 14631 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14632 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14633 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 14634 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); |
| 14635 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14636 | return 1; |
| 14637 | } |
| 14638 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14639 | /* additional initialization for auto-configuration model */ |
| 14640 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14641 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14642 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14643 | alc861_auto_init_multi_out(codec); |
| 14644 | alc861_auto_init_hp_out(codec); |
| 14645 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14646 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14647 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14648 | } |
| 14649 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14650 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14651 | static struct hda_amp_list alc861_loopbacks[] = { |
| 14652 | { 0x15, HDA_INPUT, 0 }, |
| 14653 | { 0x15, HDA_INPUT, 1 }, |
| 14654 | { 0x15, HDA_INPUT, 2 }, |
| 14655 | { 0x15, HDA_INPUT, 3 }, |
| 14656 | { } /* end */ |
| 14657 | }; |
| 14658 | #endif |
| 14659 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14660 | |
| 14661 | /* |
| 14662 | * configuration and preset |
| 14663 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14664 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 14665 | [ALC861_3ST] = "3stack", |
| 14666 | [ALC660_3ST] = "3stack-660", |
| 14667 | [ALC861_3ST_DIG] = "3stack-dig", |
| 14668 | [ALC861_6ST_DIG] = "6stack-dig", |
| 14669 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 14670 | [ALC861_TOSHIBA] = "toshiba", |
| 14671 | [ALC861_ASUS] = "asus", |
| 14672 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 14673 | [ALC861_AUTO] = "auto", |
| 14674 | }; |
| 14675 | |
| 14676 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 14677 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14678 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14679 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14680 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14681 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 14682 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 14683 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 14684 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 14685 | * Any other models that need this preset? |
| 14686 | */ |
| 14687 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 14688 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 14689 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14690 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 14691 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 14692 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 14693 | /* FIXME: the below seems conflict */ |
| 14694 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 14695 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 14696 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14697 | {} |
| 14698 | }; |
| 14699 | |
| 14700 | static struct alc_config_preset alc861_presets[] = { |
| 14701 | [ALC861_3ST] = { |
| 14702 | .mixers = { alc861_3ST_mixer }, |
| 14703 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14704 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14705 | .dac_nids = alc861_dac_nids, |
| 14706 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14707 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14708 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14709 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14710 | .adc_nids = alc861_adc_nids, |
| 14711 | .input_mux = &alc861_capture_source, |
| 14712 | }, |
| 14713 | [ALC861_3ST_DIG] = { |
| 14714 | .mixers = { alc861_base_mixer }, |
| 14715 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14716 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14717 | .dac_nids = alc861_dac_nids, |
| 14718 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14719 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14720 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14721 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14722 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14723 | .adc_nids = alc861_adc_nids, |
| 14724 | .input_mux = &alc861_capture_source, |
| 14725 | }, |
| 14726 | [ALC861_6ST_DIG] = { |
| 14727 | .mixers = { alc861_base_mixer }, |
| 14728 | .init_verbs = { alc861_base_init_verbs }, |
| 14729 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14730 | .dac_nids = alc861_dac_nids, |
| 14731 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14732 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 14733 | .channel_mode = alc861_8ch_modes, |
| 14734 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14735 | .adc_nids = alc861_adc_nids, |
| 14736 | .input_mux = &alc861_capture_source, |
| 14737 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14738 | [ALC660_3ST] = { |
| 14739 | .mixers = { alc861_3ST_mixer }, |
| 14740 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14741 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 14742 | .dac_nids = alc660_dac_nids, |
| 14743 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14744 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14745 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14746 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14747 | .adc_nids = alc861_adc_nids, |
| 14748 | .input_mux = &alc861_capture_source, |
| 14749 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14750 | [ALC861_UNIWILL_M31] = { |
| 14751 | .mixers = { alc861_uniwill_m31_mixer }, |
| 14752 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 14753 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14754 | .dac_nids = alc861_dac_nids, |
| 14755 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14756 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14757 | .channel_mode = alc861_uniwill_m31_modes, |
| 14758 | .need_dac_fix = 1, |
| 14759 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14760 | .adc_nids = alc861_adc_nids, |
| 14761 | .input_mux = &alc861_capture_source, |
| 14762 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14763 | [ALC861_TOSHIBA] = { |
| 14764 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14765 | .init_verbs = { alc861_base_init_verbs, |
| 14766 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14767 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14768 | .dac_nids = alc861_dac_nids, |
| 14769 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14770 | .channel_mode = alc883_3ST_2ch_modes, |
| 14771 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14772 | .adc_nids = alc861_adc_nids, |
| 14773 | .input_mux = &alc861_capture_source, |
| 14774 | .unsol_event = alc861_toshiba_unsol_event, |
| 14775 | .init_hook = alc861_toshiba_automute, |
| 14776 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14777 | [ALC861_ASUS] = { |
| 14778 | .mixers = { alc861_asus_mixer }, |
| 14779 | .init_verbs = { alc861_asus_init_verbs }, |
| 14780 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14781 | .dac_nids = alc861_dac_nids, |
| 14782 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14783 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 14784 | .channel_mode = alc861_asus_modes, |
| 14785 | .need_dac_fix = 1, |
| 14786 | .hp_nid = 0x06, |
| 14787 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14788 | .adc_nids = alc861_adc_nids, |
| 14789 | .input_mux = &alc861_capture_source, |
| 14790 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14791 | [ALC861_ASUS_LAPTOP] = { |
| 14792 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 14793 | .init_verbs = { alc861_asus_init_verbs, |
| 14794 | alc861_asus_laptop_init_verbs }, |
| 14795 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14796 | .dac_nids = alc861_dac_nids, |
| 14797 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14798 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14799 | .channel_mode = alc883_3ST_2ch_modes, |
| 14800 | .need_dac_fix = 1, |
| 14801 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14802 | .adc_nids = alc861_adc_nids, |
| 14803 | .input_mux = &alc861_capture_source, |
| 14804 | }, |
| 14805 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14806 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 14807 | /* Pin config fixes */ |
| 14808 | enum { |
| 14809 | PINFIX_FSC_AMILO_PI1505, |
| 14810 | }; |
| 14811 | |
| 14812 | static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = { |
| 14813 | { 0x0b, 0x0221101f }, /* HP */ |
| 14814 | { 0x0f, 0x90170310 }, /* speaker */ |
| 14815 | { } |
| 14816 | }; |
| 14817 | |
| 14818 | static const struct alc_fixup alc861_fixups[] = { |
| 14819 | [PINFIX_FSC_AMILO_PI1505] = { |
| 14820 | .pins = alc861_fsc_amilo_pi1505_pinfix |
| 14821 | }, |
| 14822 | }; |
| 14823 | |
| 14824 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 14825 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 14826 | {} |
| 14827 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14828 | |
| 14829 | static int patch_alc861(struct hda_codec *codec) |
| 14830 | { |
| 14831 | struct alc_spec *spec; |
| 14832 | int board_config; |
| 14833 | int err; |
| 14834 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 14835 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14836 | if (spec == NULL) |
| 14837 | return -ENOMEM; |
| 14838 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14839 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14840 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14841 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 14842 | alc861_models, |
| 14843 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14844 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14845 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14846 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14847 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14848 | board_config = ALC861_AUTO; |
| 14849 | } |
| 14850 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 14851 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups); |
| 14852 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14853 | if (board_config == ALC861_AUTO) { |
| 14854 | /* automatic parse from the BIOS config */ |
| 14855 | err = alc861_parse_auto_config(codec); |
| 14856 | if (err < 0) { |
| 14857 | alc_free(codec); |
| 14858 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14859 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14860 | printk(KERN_INFO |
| 14861 | "hda_codec: Cannot set up configuration " |
| 14862 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14863 | board_config = ALC861_3ST_DIG; |
| 14864 | } |
| 14865 | } |
| 14866 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14867 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14868 | if (err < 0) { |
| 14869 | alc_free(codec); |
| 14870 | return err; |
| 14871 | } |
| 14872 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14873 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14874 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14875 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14876 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 14877 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 14878 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14879 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 14880 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 14881 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14882 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 14883 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14884 | spec->vmaster_nid = 0x03; |
| 14885 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14886 | codec->patch_ops = alc_patch_ops; |
| 14887 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14888 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14889 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14890 | if (!spec->loopback.amplist) |
| 14891 | spec->loopback.amplist = alc861_loopbacks; |
| 14892 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 14893 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14894 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14895 | return 0; |
| 14896 | } |
| 14897 | |
| 14898 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14899 | * ALC861-VD support |
| 14900 | * |
| 14901 | * Based on ALC882 |
| 14902 | * |
| 14903 | * In addition, an independent DAC |
| 14904 | */ |
| 14905 | #define ALC861VD_DIGOUT_NID 0x06 |
| 14906 | |
| 14907 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 14908 | /* front, surr, clfe, side surr */ |
| 14909 | 0x02, 0x03, 0x04, 0x05 |
| 14910 | }; |
| 14911 | |
| 14912 | /* dac_nids for ALC660vd are in a different order - according to |
| 14913 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14914 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14915 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 14916 | * - and it is the same as in 861vd. |
| 14917 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 14918 | */ |
| 14919 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 14920 | /* front, rear, clfe, rear_surr */ |
| 14921 | 0x02, 0x04, 0x03 |
| 14922 | }; |
| 14923 | |
| 14924 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 14925 | /* ADC0 */ |
| 14926 | 0x09, |
| 14927 | }; |
| 14928 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14929 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 14930 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14931 | /* input MUX */ |
| 14932 | /* FIXME: should be a matrix-type input source selection */ |
| 14933 | static struct hda_input_mux alc861vd_capture_source = { |
| 14934 | .num_items = 4, |
| 14935 | .items = { |
| 14936 | { "Mic", 0x0 }, |
| 14937 | { "Front Mic", 0x1 }, |
| 14938 | { "Line", 0x2 }, |
| 14939 | { "CD", 0x4 }, |
| 14940 | }, |
| 14941 | }; |
| 14942 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14943 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14944 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14945 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14946 | { "Ext Mic", 0x0 }, |
| 14947 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14948 | }, |
| 14949 | }; |
| 14950 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14951 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 14952 | .num_items = 2, |
| 14953 | .items = { |
| 14954 | { "Front Mic", 0x0 }, |
| 14955 | { "ATAPI Mic", 0x1 }, |
| 14956 | }, |
| 14957 | }; |
| 14958 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14959 | /* |
| 14960 | * 2ch mode |
| 14961 | */ |
| 14962 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 14963 | { 2, NULL } |
| 14964 | }; |
| 14965 | |
| 14966 | /* |
| 14967 | * 6ch mode |
| 14968 | */ |
| 14969 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 14970 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14971 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14972 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14973 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14974 | { } /* end */ |
| 14975 | }; |
| 14976 | |
| 14977 | /* |
| 14978 | * 8ch mode |
| 14979 | */ |
| 14980 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 14981 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14982 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14983 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14984 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14985 | { } /* end */ |
| 14986 | }; |
| 14987 | |
| 14988 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 14989 | { 6, alc861vd_6stack_ch6_init }, |
| 14990 | { 8, alc861vd_6stack_ch8_init }, |
| 14991 | }; |
| 14992 | |
| 14993 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 14994 | { |
| 14995 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14996 | .name = "Channel Mode", |
| 14997 | .info = alc_ch_mode_info, |
| 14998 | .get = alc_ch_mode_get, |
| 14999 | .put = alc_ch_mode_put, |
| 15000 | }, |
| 15001 | { } /* end */ |
| 15002 | }; |
| 15003 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15004 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15005 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15006 | */ |
| 15007 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 15008 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15009 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15010 | |
| 15011 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15012 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 15013 | |
| 15014 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 15015 | HDA_OUTPUT), |
| 15016 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 15017 | HDA_OUTPUT), |
| 15018 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 15019 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 15020 | |
| 15021 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 15022 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 15023 | |
| 15024 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15025 | |
| 15026 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 15027 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15028 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15029 | |
| 15030 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 15031 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15032 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15033 | |
| 15034 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15035 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15036 | |
| 15037 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15038 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15039 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15040 | { } /* end */ |
| 15041 | }; |
| 15042 | |
| 15043 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 15044 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15045 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15046 | |
| 15047 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15048 | |
| 15049 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 15050 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15051 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15052 | |
| 15053 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 15054 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15055 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15056 | |
| 15057 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15058 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15059 | |
| 15060 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15061 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15062 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15063 | { } /* end */ |
| 15064 | }; |
| 15065 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15066 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 15067 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15068 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 15069 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15070 | |
| 15071 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15072 | |
| 15073 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 15074 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15075 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15076 | |
| 15077 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 15078 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15079 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15080 | |
| 15081 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15082 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15083 | |
| 15084 | { } /* end */ |
| 15085 | }; |
| 15086 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15087 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 15088 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15089 | */ |
| 15090 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15091 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15092 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15093 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15094 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15095 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 15096 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15097 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15098 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 15099 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15100 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15101 | { } /* end */ |
| 15102 | }; |
| 15103 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15104 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 15105 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 15106 | */ |
| 15107 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 15108 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15109 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15110 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15111 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 15112 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15113 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15114 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15115 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15116 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15117 | { } /* end */ |
| 15118 | }; |
| 15119 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15120 | /* |
| 15121 | * generic initialization of ADC, input mixers and output mixers |
| 15122 | */ |
| 15123 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 15124 | /* |
| 15125 | * Unmute ADC0 and set the default input to mic-in |
| 15126 | */ |
| 15127 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15128 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15129 | |
| 15130 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 15131 | * the analog-loopback mixer widget |
| 15132 | */ |
| 15133 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15134 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15135 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15136 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15137 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15138 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15139 | |
| 15140 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15141 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15142 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15143 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15144 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15145 | |
| 15146 | /* |
| 15147 | * Set up output mixers (0x02 - 0x05) |
| 15148 | */ |
| 15149 | /* set vol=0 to output mixers */ |
| 15150 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15151 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15152 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15153 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15154 | |
| 15155 | /* set up input amps for analog loopback */ |
| 15156 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 15157 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15158 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15159 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15160 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15161 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15162 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15163 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15164 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15165 | |
| 15166 | { } |
| 15167 | }; |
| 15168 | |
| 15169 | /* |
| 15170 | * 3-stack pin configuration: |
| 15171 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 15172 | */ |
| 15173 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 15174 | /* |
| 15175 | * Set pin mode and muting |
| 15176 | */ |
| 15177 | /* set front pin widgets 0x14 for output */ |
| 15178 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15179 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15180 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15181 | |
| 15182 | /* Mic (rear) pin: input vref at 80% */ |
| 15183 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15184 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15185 | /* Front Mic pin: input vref at 80% */ |
| 15186 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15187 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15188 | /* Line In pin: input */ |
| 15189 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15190 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15191 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15192 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15193 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15194 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15195 | /* CD pin widget for input */ |
| 15196 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15197 | |
| 15198 | { } |
| 15199 | }; |
| 15200 | |
| 15201 | /* |
| 15202 | * 6-stack pin configuration: |
| 15203 | */ |
| 15204 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 15205 | /* |
| 15206 | * Set pin mode and muting |
| 15207 | */ |
| 15208 | /* set front pin widgets 0x14 for output */ |
| 15209 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15210 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15211 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15212 | |
| 15213 | /* Rear Pin: output 1 (0x0d) */ |
| 15214 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15215 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15216 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 15217 | /* CLFE Pin: output 2 (0x0e) */ |
| 15218 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15219 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15220 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 15221 | /* Side Pin: output 3 (0x0f) */ |
| 15222 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15223 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15224 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 15225 | |
| 15226 | /* Mic (rear) pin: input vref at 80% */ |
| 15227 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15228 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15229 | /* Front Mic pin: input vref at 80% */ |
| 15230 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15231 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15232 | /* Line In pin: input */ |
| 15233 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15234 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15235 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15236 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15237 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15238 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15239 | /* CD pin widget for input */ |
| 15240 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15241 | |
| 15242 | { } |
| 15243 | }; |
| 15244 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15245 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 15246 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15247 | { } |
| 15248 | }; |
| 15249 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15250 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 15251 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15252 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15253 | { } |
| 15254 | }; |
| 15255 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15256 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 15257 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15258 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15259 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 15260 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15261 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15262 | {} |
| 15263 | }; |
| 15264 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15265 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 15266 | { |
| 15267 | unsigned int present; |
| 15268 | unsigned char bits; |
| 15269 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15270 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15271 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15272 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15273 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 15274 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15275 | } |
| 15276 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15277 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15278 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15279 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15280 | spec->autocfg.hp_pins[0] = 0x1b; |
| 15281 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15282 | } |
| 15283 | |
| 15284 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 15285 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15286 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15287 | alc861vd_lenovo_mic_automute(codec); |
| 15288 | } |
| 15289 | |
| 15290 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 15291 | unsigned int res) |
| 15292 | { |
| 15293 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15294 | case ALC880_MIC_EVENT: |
| 15295 | alc861vd_lenovo_mic_automute(codec); |
| 15296 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15297 | default: |
| 15298 | alc_automute_amp_unsol_event(codec, res); |
| 15299 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15300 | } |
| 15301 | } |
| 15302 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15303 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 15304 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15305 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15306 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15307 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15308 | |
| 15309 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15310 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15311 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15312 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15313 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15314 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15315 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15316 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15317 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15318 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15319 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15320 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15321 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15322 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15323 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15324 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15325 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15326 | |
| 15327 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15328 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15329 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15330 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15331 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15332 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15333 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15334 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15335 | |
| 15336 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15337 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15338 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15339 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 15340 | |
| 15341 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15342 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15343 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15344 | |
| 15345 | { } /* end */ |
| 15346 | }; |
| 15347 | |
| 15348 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15349 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15350 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15351 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15352 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15353 | spec->autocfg.hp_pins[0] = 0x15; |
| 15354 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15355 | } |
| 15356 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15357 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15358 | #define alc861vd_loopbacks alc880_loopbacks |
| 15359 | #endif |
| 15360 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15361 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15362 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 15363 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 15364 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 15365 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 15366 | |
| 15367 | /* |
| 15368 | * configuration and preset |
| 15369 | */ |
| 15370 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 15371 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15372 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15373 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15374 | [ALC861VD_3ST] = "3stack", |
| 15375 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 15376 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15377 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15378 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15379 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15380 | [ALC861VD_AUTO] = "auto", |
| 15381 | }; |
| 15382 | |
| 15383 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15384 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 15385 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 15386 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 15387 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15388 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15389 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15390 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15391 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 15392 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 15393 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 15394 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15395 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 15396 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 15397 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 15398 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15399 | {} |
| 15400 | }; |
| 15401 | |
| 15402 | static struct alc_config_preset alc861vd_presets[] = { |
| 15403 | [ALC660VD_3ST] = { |
| 15404 | .mixers = { alc861vd_3st_mixer }, |
| 15405 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15406 | alc861vd_3stack_init_verbs }, |
| 15407 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15408 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15409 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15410 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15411 | .input_mux = &alc861vd_capture_source, |
| 15412 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15413 | [ALC660VD_3ST_DIG] = { |
| 15414 | .mixers = { alc861vd_3st_mixer }, |
| 15415 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15416 | alc861vd_3stack_init_verbs }, |
| 15417 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15418 | .dac_nids = alc660vd_dac_nids, |
| 15419 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15420 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15421 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15422 | .input_mux = &alc861vd_capture_source, |
| 15423 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15424 | [ALC861VD_3ST] = { |
| 15425 | .mixers = { alc861vd_3st_mixer }, |
| 15426 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15427 | alc861vd_3stack_init_verbs }, |
| 15428 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15429 | .dac_nids = alc861vd_dac_nids, |
| 15430 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15431 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15432 | .input_mux = &alc861vd_capture_source, |
| 15433 | }, |
| 15434 | [ALC861VD_3ST_DIG] = { |
| 15435 | .mixers = { alc861vd_3st_mixer }, |
| 15436 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15437 | alc861vd_3stack_init_verbs }, |
| 15438 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15439 | .dac_nids = alc861vd_dac_nids, |
| 15440 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15441 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15442 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15443 | .input_mux = &alc861vd_capture_source, |
| 15444 | }, |
| 15445 | [ALC861VD_6ST_DIG] = { |
| 15446 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 15447 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15448 | alc861vd_6stack_init_verbs }, |
| 15449 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15450 | .dac_nids = alc861vd_dac_nids, |
| 15451 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15452 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 15453 | .channel_mode = alc861vd_6stack_modes, |
| 15454 | .input_mux = &alc861vd_capture_source, |
| 15455 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15456 | [ALC861VD_LENOVO] = { |
| 15457 | .mixers = { alc861vd_lenovo_mixer }, |
| 15458 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15459 | alc861vd_3stack_init_verbs, |
| 15460 | alc861vd_eapd_verbs, |
| 15461 | alc861vd_lenovo_unsol_verbs }, |
| 15462 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15463 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15464 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15465 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15466 | .input_mux = &alc861vd_capture_source, |
| 15467 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15468 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15469 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15470 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15471 | [ALC861VD_DALLAS] = { |
| 15472 | .mixers = { alc861vd_dallas_mixer }, |
| 15473 | .init_verbs = { alc861vd_dallas_verbs }, |
| 15474 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15475 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15476 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15477 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15478 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15479 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15480 | .setup = alc861vd_dallas_setup, |
| 15481 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15482 | }, |
| 15483 | [ALC861VD_HP] = { |
| 15484 | .mixers = { alc861vd_hp_mixer }, |
| 15485 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 15486 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15487 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15488 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15489 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15490 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15491 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15492 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15493 | .setup = alc861vd_dallas_setup, |
| 15494 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15495 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15496 | [ALC660VD_ASUS_V1S] = { |
| 15497 | .mixers = { alc861vd_lenovo_mixer }, |
| 15498 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15499 | alc861vd_3stack_init_verbs, |
| 15500 | alc861vd_eapd_verbs, |
| 15501 | alc861vd_lenovo_unsol_verbs }, |
| 15502 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15503 | .dac_nids = alc660vd_dac_nids, |
| 15504 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15505 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15506 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15507 | .input_mux = &alc861vd_capture_source, |
| 15508 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15509 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15510 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15511 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15512 | }; |
| 15513 | |
| 15514 | /* |
| 15515 | * BIOS auto configuration |
| 15516 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15517 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 15518 | const struct auto_pin_cfg *cfg) |
| 15519 | { |
Takashi Iwai | 9c0afc8 | 2010-01-12 14:00:11 +0100 | [diff] [blame] | 15520 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x22, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15521 | } |
| 15522 | |
| 15523 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15524 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15525 | hda_nid_t nid, int pin_type, int dac_idx) |
| 15526 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15527 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15528 | } |
| 15529 | |
| 15530 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 15531 | { |
| 15532 | struct alc_spec *spec = codec->spec; |
| 15533 | int i; |
| 15534 | |
| 15535 | for (i = 0; i <= HDA_SIDE; i++) { |
| 15536 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15537 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15538 | if (nid) |
| 15539 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15540 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15541 | } |
| 15542 | } |
| 15543 | |
| 15544 | |
| 15545 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 15546 | { |
| 15547 | struct alc_spec *spec = codec->spec; |
| 15548 | hda_nid_t pin; |
| 15549 | |
| 15550 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15551 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15552 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15553 | pin = spec->autocfg.speaker_pins[0]; |
| 15554 | if (pin) |
| 15555 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15556 | } |
| 15557 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15558 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 15559 | |
| 15560 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 15561 | { |
| 15562 | struct alc_spec *spec = codec->spec; |
| 15563 | int i; |
| 15564 | |
| 15565 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15566 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15567 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15568 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 15569 | if (nid != ALC861VD_PIN_CD_NID && |
| 15570 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15571 | snd_hda_codec_write(codec, nid, 0, |
| 15572 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 15573 | AMP_OUT_MUTE); |
| 15574 | } |
| 15575 | } |
| 15576 | } |
| 15577 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15578 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 15579 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15580 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 15581 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 15582 | |
| 15583 | /* add playback controls from the parsed DAC table */ |
| 15584 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15585 | * different NIDs for mute/unmute switch and volume control */ |
| 15586 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 15587 | const struct auto_pin_cfg *cfg) |
| 15588 | { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15589 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 15590 | hda_nid_t nid_v, nid_s; |
| 15591 | int i, err; |
| 15592 | |
| 15593 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15594 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15595 | continue; |
| 15596 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15597 | alc880_dac_to_idx( |
| 15598 | spec->multiout.dac_nids[i])); |
| 15599 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15600 | alc880_dac_to_idx( |
| 15601 | spec->multiout.dac_nids[i])); |
| 15602 | |
| 15603 | if (i == 2) { |
| 15604 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15605 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 15606 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15607 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 15608 | HDA_OUTPUT)); |
| 15609 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15610 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15611 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 15612 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15613 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 15614 | HDA_OUTPUT)); |
| 15615 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15616 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15617 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 15618 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15619 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 15620 | HDA_INPUT)); |
| 15621 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15622 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15623 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 15624 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15625 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 15626 | HDA_INPUT)); |
| 15627 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15628 | return err; |
| 15629 | } else { |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 15630 | const char *pfx; |
| 15631 | if (cfg->line_outs == 1 && |
| 15632 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
| 15633 | if (!cfg->hp_pins) |
| 15634 | pfx = "Speaker"; |
| 15635 | else |
| 15636 | pfx = "PCM"; |
| 15637 | } else |
| 15638 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15639 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15640 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 15641 | HDA_OUTPUT)); |
| 15642 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15643 | return err; |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 15644 | if (cfg->line_outs == 1 && |
| 15645 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 15646 | pfx = "Speaker"; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15647 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15648 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15649 | HDA_INPUT)); |
| 15650 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15651 | return err; |
| 15652 | } |
| 15653 | } |
| 15654 | return 0; |
| 15655 | } |
| 15656 | |
| 15657 | /* add playback controls for speaker and HP outputs */ |
| 15658 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15659 | * different NIDs for mute/unmute switch and volume control */ |
| 15660 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 15661 | hda_nid_t pin, const char *pfx) |
| 15662 | { |
| 15663 | hda_nid_t nid_v, nid_s; |
| 15664 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15665 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15666 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15667 | return 0; |
| 15668 | |
| 15669 | if (alc880_is_fixed_pin(pin)) { |
| 15670 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 15671 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15672 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15673 | spec->multiout.hp_nid = nid_v; |
| 15674 | else |
| 15675 | spec->multiout.extra_out_nid[0] = nid_v; |
| 15676 | /* control HP volume/switch on the output mixer amp */ |
| 15677 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15678 | alc880_fixed_pin_idx(pin)); |
| 15679 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15680 | alc880_fixed_pin_idx(pin)); |
| 15681 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15682 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15683 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 15684 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15685 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15686 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15687 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 15688 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15689 | return err; |
| 15690 | } else if (alc880_is_multi_pin(pin)) { |
| 15691 | /* set manual connection */ |
| 15692 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15693 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15694 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 15695 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15696 | return err; |
| 15697 | } |
| 15698 | return 0; |
| 15699 | } |
| 15700 | |
| 15701 | /* parse the BIOS configuration and set up the alc_spec |
| 15702 | * return 1 if successful, 0 if the proper config is not found, |
| 15703 | * or a negative error code |
| 15704 | * Based on ALC880 version - had to change it to override |
| 15705 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 15706 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 15707 | { |
| 15708 | struct alc_spec *spec = codec->spec; |
| 15709 | int err; |
| 15710 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 15711 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15712 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15713 | alc861vd_ignore); |
| 15714 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15715 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15716 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15717 | return 0; /* can't find valid BIOS pin config */ |
| 15718 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15719 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 15720 | if (err < 0) |
| 15721 | return err; |
| 15722 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 15723 | if (err < 0) |
| 15724 | return err; |
| 15725 | err = alc861vd_auto_create_extra_out(spec, |
| 15726 | spec->autocfg.speaker_pins[0], |
| 15727 | "Speaker"); |
| 15728 | if (err < 0) |
| 15729 | return err; |
| 15730 | err = alc861vd_auto_create_extra_out(spec, |
| 15731 | spec->autocfg.hp_pins[0], |
| 15732 | "Headphone"); |
| 15733 | if (err < 0) |
| 15734 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15735 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15736 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15737 | return err; |
| 15738 | |
| 15739 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15740 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 15741 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15742 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 15743 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15744 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15745 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15746 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15747 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15748 | |
| 15749 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15750 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15751 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 15752 | err = alc_auto_add_mic_boost(codec); |
| 15753 | if (err < 0) |
| 15754 | return err; |
| 15755 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15756 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 15757 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15758 | return 1; |
| 15759 | } |
| 15760 | |
| 15761 | /* additional initialization for auto-configuration model */ |
| 15762 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 15763 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15764 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15765 | alc861vd_auto_init_multi_out(codec); |
| 15766 | alc861vd_auto_init_hp_out(codec); |
| 15767 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15768 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15769 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15770 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15771 | } |
| 15772 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 15773 | enum { |
| 15774 | ALC660VD_FIX_ASUS_GPIO1 |
| 15775 | }; |
| 15776 | |
| 15777 | /* reset GPIO1 */ |
| 15778 | static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = { |
| 15779 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 15780 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 15781 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 15782 | { } |
| 15783 | }; |
| 15784 | |
| 15785 | static const struct alc_fixup alc861vd_fixups[] = { |
| 15786 | [ALC660VD_FIX_ASUS_GPIO1] = { |
| 15787 | .verbs = alc660vd_fix_asus_gpio1_verbs, |
| 15788 | }, |
| 15789 | }; |
| 15790 | |
| 15791 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 15792 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 15793 | {} |
| 15794 | }; |
| 15795 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15796 | static int patch_alc861vd(struct hda_codec *codec) |
| 15797 | { |
| 15798 | struct alc_spec *spec; |
| 15799 | int err, board_config; |
| 15800 | |
| 15801 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15802 | if (spec == NULL) |
| 15803 | return -ENOMEM; |
| 15804 | |
| 15805 | codec->spec = spec; |
| 15806 | |
| 15807 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 15808 | alc861vd_models, |
| 15809 | alc861vd_cfg_tbl); |
| 15810 | |
| 15811 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15812 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15813 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15814 | board_config = ALC861VD_AUTO; |
| 15815 | } |
| 15816 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 15817 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups); |
| 15818 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15819 | if (board_config == ALC861VD_AUTO) { |
| 15820 | /* automatic parse from the BIOS config */ |
| 15821 | err = alc861vd_parse_auto_config(codec); |
| 15822 | if (err < 0) { |
| 15823 | alc_free(codec); |
| 15824 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15825 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15826 | printk(KERN_INFO |
| 15827 | "hda_codec: Cannot set up configuration " |
| 15828 | "from BIOS. Using base mode...\n"); |
| 15829 | board_config = ALC861VD_3ST; |
| 15830 | } |
| 15831 | } |
| 15832 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15833 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15834 | if (err < 0) { |
| 15835 | alc_free(codec); |
| 15836 | return err; |
| 15837 | } |
| 15838 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15839 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15840 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15841 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15842 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15843 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15844 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15845 | } |
| 15846 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15847 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 15848 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 15849 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15850 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 15851 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 15852 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 15853 | if (!spec->adc_nids) { |
| 15854 | spec->adc_nids = alc861vd_adc_nids; |
| 15855 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 15856 | } |
| 15857 | if (!spec->capsrc_nids) |
| 15858 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15859 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15860 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15861 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15862 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15863 | spec->vmaster_nid = 0x02; |
| 15864 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15865 | codec->patch_ops = alc_patch_ops; |
| 15866 | |
| 15867 | if (board_config == ALC861VD_AUTO) |
| 15868 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15869 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15870 | if (!spec->loopback.amplist) |
| 15871 | spec->loopback.amplist = alc861vd_loopbacks; |
| 15872 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 15873 | codec->proc_widget_hook = print_realtek_coef; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15874 | |
| 15875 | return 0; |
| 15876 | } |
| 15877 | |
| 15878 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15879 | * ALC662 support |
| 15880 | * |
| 15881 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 15882 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 15883 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 15884 | * 6-channel independent captures. |
| 15885 | * |
| 15886 | * In addition, an independent DAC for the multi-playback (not used in this |
| 15887 | * driver yet). |
| 15888 | */ |
| 15889 | #define ALC662_DIGOUT_NID 0x06 |
| 15890 | #define ALC662_DIGIN_NID 0x0a |
| 15891 | |
| 15892 | static hda_nid_t alc662_dac_nids[4] = { |
| 15893 | /* front, rear, clfe, rear_surr */ |
| 15894 | 0x02, 0x03, 0x04 |
| 15895 | }; |
| 15896 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15897 | static hda_nid_t alc272_dac_nids[2] = { |
| 15898 | 0x02, 0x03 |
| 15899 | }; |
| 15900 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15901 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15902 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15903 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15904 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15905 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15906 | static hda_nid_t alc272_adc_nids[1] = { |
| 15907 | /* ADC1-2 */ |
| 15908 | 0x08, |
| 15909 | }; |
| 15910 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15911 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15912 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 15913 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15914 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15915 | /* input MUX */ |
| 15916 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15917 | static struct hda_input_mux alc662_capture_source = { |
| 15918 | .num_items = 4, |
| 15919 | .items = { |
| 15920 | { "Mic", 0x0 }, |
| 15921 | { "Front Mic", 0x1 }, |
| 15922 | { "Line", 0x2 }, |
| 15923 | { "CD", 0x4 }, |
| 15924 | }, |
| 15925 | }; |
| 15926 | |
| 15927 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 15928 | .num_items = 2, |
| 15929 | .items = { |
| 15930 | { "Mic", 0x1 }, |
| 15931 | { "Line", 0x2 }, |
| 15932 | }, |
| 15933 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15934 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15935 | static struct hda_input_mux alc663_capture_source = { |
| 15936 | .num_items = 3, |
| 15937 | .items = { |
| 15938 | { "Mic", 0x0 }, |
| 15939 | { "Front Mic", 0x1 }, |
| 15940 | { "Line", 0x2 }, |
| 15941 | }, |
| 15942 | }; |
| 15943 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15944 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 15945 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15946 | .num_items = 16, |
| 15947 | .items = { |
| 15948 | { "Autoselect Mic", 0x0 }, |
| 15949 | { "Internal Mic", 0x1 }, |
| 15950 | { "In-0x02", 0x2 }, |
| 15951 | { "In-0x03", 0x3 }, |
| 15952 | { "In-0x04", 0x4 }, |
| 15953 | { "In-0x05", 0x5 }, |
| 15954 | { "In-0x06", 0x6 }, |
| 15955 | { "In-0x07", 0x7 }, |
| 15956 | { "In-0x08", 0x8 }, |
| 15957 | { "In-0x09", 0x9 }, |
| 15958 | { "In-0x0a", 0x0a }, |
| 15959 | { "In-0x0b", 0x0b }, |
| 15960 | { "In-0x0c", 0x0c }, |
| 15961 | { "In-0x0d", 0x0d }, |
| 15962 | { "In-0x0e", 0x0e }, |
| 15963 | { "In-0x0f", 0x0f }, |
| 15964 | }, |
| 15965 | }; |
| 15966 | #endif |
| 15967 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15968 | /* |
| 15969 | * 2ch mode |
| 15970 | */ |
| 15971 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 15972 | { 2, NULL } |
| 15973 | }; |
| 15974 | |
| 15975 | /* |
| 15976 | * 2ch mode |
| 15977 | */ |
| 15978 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 15979 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 15980 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15981 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 15982 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15983 | { } /* end */ |
| 15984 | }; |
| 15985 | |
| 15986 | /* |
| 15987 | * 6ch mode |
| 15988 | */ |
| 15989 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 15990 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15991 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15992 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 15993 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15994 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15995 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15996 | { } /* end */ |
| 15997 | }; |
| 15998 | |
| 15999 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 16000 | { 2, alc662_3ST_ch2_init }, |
| 16001 | { 6, alc662_3ST_ch6_init }, |
| 16002 | }; |
| 16003 | |
| 16004 | /* |
| 16005 | * 2ch mode |
| 16006 | */ |
| 16007 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 16008 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16009 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16010 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16011 | { } /* end */ |
| 16012 | }; |
| 16013 | |
| 16014 | /* |
| 16015 | * 6ch mode |
| 16016 | */ |
| 16017 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 16018 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16019 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16020 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16021 | { } /* end */ |
| 16022 | }; |
| 16023 | |
| 16024 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 16025 | { 2, alc662_sixstack_ch6_init }, |
| 16026 | { 6, alc662_sixstack_ch8_init }, |
| 16027 | }; |
| 16028 | |
| 16029 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16030 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16031 | */ |
| 16032 | |
| 16033 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 16034 | /* output mixer control */ |
| 16035 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16036 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16037 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16038 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16039 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 16040 | 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] | 16041 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 16042 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16043 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16044 | |
| 16045 | /*Input mixer control */ |
| 16046 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 16047 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 16048 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 16049 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 16050 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 16051 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 16052 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 16053 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16054 | { } /* end */ |
| 16055 | }; |
| 16056 | |
| 16057 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 16058 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16059 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16060 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16061 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16062 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16063 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16064 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16065 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16066 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16067 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16068 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16069 | { } /* end */ |
| 16070 | }; |
| 16071 | |
| 16072 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 16073 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16074 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16075 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16076 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16077 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 16078 | 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] | 16079 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 16080 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16081 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16082 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16083 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16084 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16085 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16086 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16087 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16088 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16089 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16090 | { } /* end */ |
| 16091 | }; |
| 16092 | |
| 16093 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 16094 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16095 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 16096 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16097 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16098 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16099 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16100 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16101 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16102 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16103 | { } /* end */ |
| 16104 | }; |
| 16105 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16106 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16107 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16108 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16109 | |
| 16110 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 16111 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16112 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16113 | |
| 16114 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16115 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16116 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16117 | { } /* end */ |
| 16118 | }; |
| 16119 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16120 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16121 | ALC262_HIPPO_MASTER_SWITCH, |
| 16122 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16123 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16124 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 16125 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16126 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16127 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16128 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16129 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16130 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16131 | { } /* end */ |
| 16132 | }; |
| 16133 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16134 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 16135 | .ops = &snd_hda_bind_vol, |
| 16136 | .values = { |
| 16137 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 16138 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 16139 | 0 |
| 16140 | }, |
| 16141 | }; |
| 16142 | |
| 16143 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 16144 | .ops = &snd_hda_bind_sw, |
| 16145 | .values = { |
| 16146 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16147 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 16148 | 0 |
| 16149 | }, |
| 16150 | }; |
| 16151 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16152 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16153 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16154 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 16155 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16156 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16157 | { } /* end */ |
| 16158 | }; |
| 16159 | |
| 16160 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 16161 | .ops = &snd_hda_bind_sw, |
| 16162 | .values = { |
| 16163 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16164 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 16165 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 16166 | 0 |
| 16167 | }, |
| 16168 | }; |
| 16169 | |
| 16170 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 16171 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16172 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 16173 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16174 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16175 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16176 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16177 | |
| 16178 | { } /* end */ |
| 16179 | }; |
| 16180 | |
| 16181 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 16182 | .ops = &snd_hda_bind_sw, |
| 16183 | .values = { |
| 16184 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16185 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 16186 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 16187 | 0 |
| 16188 | }, |
| 16189 | }; |
| 16190 | |
| 16191 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 16192 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16193 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 16194 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16195 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16196 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16197 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16198 | { } /* end */ |
| 16199 | }; |
| 16200 | |
| 16201 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16202 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16203 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16204 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16205 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16206 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16207 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16208 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16209 | { } /* end */ |
| 16210 | }; |
| 16211 | |
| 16212 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 16213 | .ops = &snd_hda_bind_vol, |
| 16214 | .values = { |
| 16215 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 16216 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 16217 | 0 |
| 16218 | }, |
| 16219 | }; |
| 16220 | |
| 16221 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 16222 | .ops = &snd_hda_bind_sw, |
| 16223 | .values = { |
| 16224 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16225 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 16226 | 0 |
| 16227 | }, |
| 16228 | }; |
| 16229 | |
| 16230 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 16231 | HDA_BIND_VOL("Master Playback Volume", |
| 16232 | &alc663_asus_two_bind_master_vol), |
| 16233 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 16234 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16235 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16236 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16237 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16238 | { } /* end */ |
| 16239 | }; |
| 16240 | |
| 16241 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 16242 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16243 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 16244 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16245 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 16246 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16247 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16248 | { } /* end */ |
| 16249 | }; |
| 16250 | |
| 16251 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 16252 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16253 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16254 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16255 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 16256 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16257 | |
| 16258 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16259 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16260 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16261 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16262 | { } /* end */ |
| 16263 | }; |
| 16264 | |
| 16265 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 16266 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16267 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16268 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16269 | |
| 16270 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16271 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16272 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16273 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16274 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16275 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16276 | { } /* end */ |
| 16277 | }; |
| 16278 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16279 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 16280 | .ops = &snd_hda_bind_sw, |
| 16281 | .values = { |
| 16282 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16283 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 16284 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 16285 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 16286 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 16287 | 0 |
| 16288 | }, |
| 16289 | }; |
| 16290 | |
| 16291 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
| 16292 | .ops = &snd_hda_bind_sw, |
| 16293 | .values = { |
| 16294 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16295 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 16296 | 0 |
| 16297 | }, |
| 16298 | }; |
| 16299 | |
| 16300 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { |
| 16301 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 16302 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 16303 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 16304 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16305 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16306 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16307 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16308 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16309 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16310 | { } /* end */ |
| 16311 | }; |
| 16312 | |
| 16313 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 16314 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 16315 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 16316 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 16317 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 16318 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16319 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16320 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16321 | { } /* end */ |
| 16322 | }; |
| 16323 | |
| 16324 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16325 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 16326 | { |
| 16327 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16328 | .name = "Channel Mode", |
| 16329 | .info = alc_ch_mode_info, |
| 16330 | .get = alc_ch_mode_get, |
| 16331 | .put = alc_ch_mode_put, |
| 16332 | }, |
| 16333 | { } /* end */ |
| 16334 | }; |
| 16335 | |
| 16336 | static struct hda_verb alc662_init_verbs[] = { |
| 16337 | /* ADC: mute amp left and right */ |
| 16338 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16339 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16340 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 16341 | |
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 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16348 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16349 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16350 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16351 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16352 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16353 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16354 | |
| 16355 | /* Front Pin: output 0 (0x0c) */ |
| 16356 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16357 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16358 | |
| 16359 | /* Rear Pin: output 1 (0x0d) */ |
| 16360 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16361 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16362 | |
| 16363 | /* CLFE Pin: output 2 (0x0e) */ |
| 16364 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16365 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16366 | |
| 16367 | /* Mic (rear) pin: input vref at 80% */ |
| 16368 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16369 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16370 | /* Front Mic pin: input vref at 80% */ |
| 16371 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16372 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16373 | /* Line In pin: input */ |
| 16374 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16375 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16376 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16377 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16378 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16379 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16380 | /* CD pin widget for input */ |
| 16381 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16382 | |
| 16383 | /* FIXME: use matrix-type input source selection */ |
| 16384 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 16385 | /* Input mixer */ |
| 16386 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16387 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16388 | |
| 16389 | /* always trun on EAPD */ |
| 16390 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16391 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16392 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16393 | { } |
| 16394 | }; |
| 16395 | |
| 16396 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 16397 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16398 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16399 | {} |
| 16400 | }; |
| 16401 | |
| 16402 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 16403 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16404 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16405 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16406 | }; |
| 16407 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16408 | /* Set Unsolicited Event*/ |
| 16409 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 16410 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16411 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16412 | {} |
| 16413 | }; |
| 16414 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16415 | /* |
| 16416 | * generic initialization of ADC, input mixers and output mixers |
| 16417 | */ |
| 16418 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 16419 | /* |
| 16420 | * Unmute ADC and set the default input to mic-in |
| 16421 | */ |
| 16422 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16423 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16424 | |
| 16425 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 16426 | * mixer widget |
| 16427 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 16428 | * panel mic (mic 2) |
| 16429 | */ |
| 16430 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16431 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16432 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16433 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16434 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16435 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16436 | |
| 16437 | /* |
| 16438 | * Set up output mixers (0x0c - 0x0f) |
| 16439 | */ |
| 16440 | /* set vol=0 to output mixers */ |
| 16441 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16442 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16443 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16444 | |
| 16445 | /* set up input amps for analog loopback */ |
| 16446 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16447 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16448 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16449 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16450 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16451 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16452 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16453 | |
| 16454 | |
| 16455 | /* FIXME: use matrix-type input source selection */ |
| 16456 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 16457 | /* Input mixer */ |
| 16458 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16459 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16460 | { } |
| 16461 | }; |
| 16462 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16463 | /* additional verbs for ALC663 */ |
| 16464 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 16465 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16466 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16467 | { } |
| 16468 | }; |
| 16469 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16470 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16471 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16472 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16473 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16474 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16475 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16476 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16477 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16478 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16479 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16480 | {} |
| 16481 | }; |
| 16482 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16483 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 16484 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16485 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16486 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16487 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16488 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16489 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16490 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16491 | {} |
| 16492 | }; |
| 16493 | |
| 16494 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 16495 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16496 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16497 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16498 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16499 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16500 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16501 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16502 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16503 | {} |
| 16504 | }; |
| 16505 | |
| 16506 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 16507 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16508 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16509 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16510 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16511 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16512 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16513 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16514 | {} |
| 16515 | }; |
| 16516 | |
| 16517 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 16518 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16519 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16520 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16521 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16522 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16523 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16524 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16525 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16526 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16527 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16528 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16529 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16530 | {} |
| 16531 | }; |
| 16532 | |
| 16533 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 16534 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16535 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16536 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16537 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16538 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16539 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16540 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16541 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16542 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16543 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16544 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16545 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16546 | {} |
| 16547 | }; |
| 16548 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16549 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 16550 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16551 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 16552 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 16553 | |
| 16554 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16555 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16556 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16557 | |
| 16558 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16559 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 16560 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 16561 | {} |
| 16562 | }; |
| 16563 | |
| 16564 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 16565 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16566 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16567 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16568 | |
| 16569 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16570 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16571 | {} |
| 16572 | }; |
| 16573 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16574 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 16575 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 16576 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16577 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16578 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16579 | {} |
| 16580 | }; |
| 16581 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16582 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 16583 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16584 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16585 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16586 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16587 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16588 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16589 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16590 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16591 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16592 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16593 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16594 | {} |
| 16595 | }; |
| 16596 | |
| 16597 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 16598 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16599 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16600 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16601 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16602 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16603 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16604 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16605 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16606 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16607 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16608 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16609 | {} |
| 16610 | }; |
| 16611 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16612 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 16613 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16614 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16615 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16616 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16617 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16618 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16619 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16620 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16621 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16622 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16623 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16624 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16625 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16626 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16627 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16628 | {} |
| 16629 | }; |
| 16630 | |
| 16631 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 16632 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16633 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16634 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16635 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16636 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16637 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16638 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16639 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16640 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16641 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16642 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16643 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16644 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16645 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16646 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16647 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16648 | {} |
| 16649 | }; |
| 16650 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16651 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 16652 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 16653 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 16654 | { } /* end */ |
| 16655 | }; |
| 16656 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16657 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 16658 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 16659 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 16660 | { } /* end */ |
| 16661 | }; |
| 16662 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16663 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 16664 | { |
| 16665 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16666 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16667 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16668 | present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16669 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16670 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16671 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16672 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16673 | } |
| 16674 | |
| 16675 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 16676 | { |
| 16677 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16678 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16679 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16680 | present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16681 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16682 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16683 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16684 | HDA_AMP_MUTE, bits); |
| 16685 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16686 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16687 | } |
| 16688 | |
| 16689 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 16690 | unsigned int res) |
| 16691 | { |
| 16692 | if ((res >> 26) == ALC880_HP_EVENT) |
| 16693 | alc662_lenovo_101e_all_automute(codec); |
| 16694 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 16695 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 16696 | } |
| 16697 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16698 | /* unsolicited event for HP jack sensing */ |
| 16699 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 16700 | unsigned int res) |
| 16701 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16702 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16703 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16704 | else |
| 16705 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16706 | } |
| 16707 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16708 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16709 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16710 | struct alc_spec *spec = codec->spec; |
| 16711 | |
| 16712 | alc262_hippo1_setup(codec); |
| 16713 | spec->ext_mic.pin = 0x18; |
| 16714 | spec->ext_mic.mux_idx = 0; |
| 16715 | spec->int_mic.pin = 0x19; |
| 16716 | spec->int_mic.mux_idx = 1; |
| 16717 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16718 | } |
| 16719 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16720 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 16721 | { |
| 16722 | alc262_hippo_automute(codec); |
| 16723 | alc_mic_automute(codec); |
| 16724 | } |
| 16725 | |
| 16726 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16727 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16728 | struct alc_spec *spec = codec->spec; |
| 16729 | |
| 16730 | spec->autocfg.hp_pins[0] = 0x14; |
| 16731 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16732 | } |
| 16733 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16734 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 16735 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16736 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 16737 | { |
| 16738 | unsigned int present; |
| 16739 | unsigned char bits; |
| 16740 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16741 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16742 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16743 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16744 | AMP_IN_MUTE(0), bits); |
| 16745 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16746 | AMP_IN_MUTE(0), bits); |
| 16747 | } |
| 16748 | |
| 16749 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 16750 | { |
| 16751 | unsigned int present; |
| 16752 | unsigned char bits; |
| 16753 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16754 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16755 | bits = present ? HDA_AMP_MUTE : 0; |
| 16756 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16757 | AMP_IN_MUTE(0), bits); |
| 16758 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16759 | AMP_IN_MUTE(0), bits); |
| 16760 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16761 | AMP_IN_MUTE(0), bits); |
| 16762 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16763 | AMP_IN_MUTE(0), bits); |
| 16764 | } |
| 16765 | |
| 16766 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 16767 | { |
| 16768 | unsigned int present; |
| 16769 | unsigned char bits; |
| 16770 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16771 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16772 | bits = present ? HDA_AMP_MUTE : 0; |
| 16773 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16774 | AMP_IN_MUTE(0), bits); |
| 16775 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16776 | AMP_IN_MUTE(0), bits); |
| 16777 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16778 | AMP_IN_MUTE(0), bits); |
| 16779 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16780 | AMP_IN_MUTE(0), bits); |
| 16781 | } |
| 16782 | |
| 16783 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 16784 | { |
| 16785 | unsigned int present; |
| 16786 | unsigned char bits; |
| 16787 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16788 | present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16789 | bits = present ? 0 : PIN_OUT; |
| 16790 | snd_hda_codec_write(codec, 0x14, 0, |
| 16791 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 16792 | } |
| 16793 | |
| 16794 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 16795 | { |
| 16796 | unsigned int present1, present2; |
| 16797 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16798 | present1 = snd_hda_jack_detect(codec, 0x21); |
| 16799 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16800 | |
| 16801 | if (present1 || present2) { |
| 16802 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16803 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16804 | } else { |
| 16805 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16806 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16807 | } |
| 16808 | } |
| 16809 | |
| 16810 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 16811 | { |
| 16812 | unsigned int present1, present2; |
| 16813 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16814 | present1 = snd_hda_jack_detect(codec, 0x1b); |
| 16815 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16816 | |
| 16817 | if (present1 || present2) { |
| 16818 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16819 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16820 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16821 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16822 | } else { |
| 16823 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16824 | AMP_IN_MUTE(0), 0); |
| 16825 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16826 | AMP_IN_MUTE(0), 0); |
| 16827 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16828 | } |
| 16829 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16830 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
| 16831 | { |
| 16832 | unsigned int present1, present2; |
| 16833 | |
| 16834 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 16835 | AC_VERB_GET_PIN_SENSE, 0) |
| 16836 | & AC_PINSENSE_PRESENCE; |
| 16837 | present2 = snd_hda_codec_read(codec, 0x21, 0, |
| 16838 | AC_VERB_GET_PIN_SENSE, 0) |
| 16839 | & AC_PINSENSE_PRESENCE; |
| 16840 | |
| 16841 | if (present1 || present2) { |
| 16842 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16843 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16844 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 16845 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16846 | } else { |
| 16847 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16848 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16849 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 16850 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16851 | } |
| 16852 | } |
| 16853 | |
| 16854 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) |
| 16855 | { |
| 16856 | unsigned int present1, present2; |
| 16857 | |
| 16858 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 16859 | AC_VERB_GET_PIN_SENSE, 0) |
| 16860 | & AC_PINSENSE_PRESENCE; |
| 16861 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16862 | AC_VERB_GET_PIN_SENSE, 0) |
| 16863 | & AC_PINSENSE_PRESENCE; |
| 16864 | |
| 16865 | if (present1 || present2) { |
| 16866 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16867 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16868 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 16869 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16870 | } else { |
| 16871 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16872 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16873 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 16874 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16875 | } |
| 16876 | } |
| 16877 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16878 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 16879 | unsigned int res) |
| 16880 | { |
| 16881 | switch (res >> 26) { |
| 16882 | case ALC880_HP_EVENT: |
| 16883 | alc663_m51va_speaker_automute(codec); |
| 16884 | break; |
| 16885 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16886 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16887 | break; |
| 16888 | } |
| 16889 | } |
| 16890 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16891 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 16892 | { |
| 16893 | struct alc_spec *spec = codec->spec; |
| 16894 | spec->ext_mic.pin = 0x18; |
| 16895 | spec->ext_mic.mux_idx = 0; |
| 16896 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16897 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16898 | spec->auto_mic = 1; |
| 16899 | } |
| 16900 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16901 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 16902 | { |
| 16903 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16904 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16905 | } |
| 16906 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16907 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16908 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16909 | |
| 16910 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 16911 | { |
| 16912 | struct alc_spec *spec = codec->spec; |
| 16913 | spec->ext_mic.pin = 0x18; |
| 16914 | spec->ext_mic.mux_idx = 0; |
| 16915 | spec->int_mic.pin = 0x19; |
| 16916 | spec->int_mic.mux_idx = 1; |
| 16917 | spec->auto_mic = 1; |
| 16918 | } |
| 16919 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16920 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16921 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16922 | /* ***************** Mode2 ******************************/ |
| 16923 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 16924 | unsigned int res) |
| 16925 | { |
| 16926 | switch (res >> 26) { |
| 16927 | case ALC880_HP_EVENT: |
| 16928 | alc662_f5z_speaker_automute(codec); |
| 16929 | break; |
| 16930 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16931 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16932 | break; |
| 16933 | } |
| 16934 | } |
| 16935 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16936 | #define alc662_mode2_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16937 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16938 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 16939 | { |
| 16940 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16941 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16942 | } |
| 16943 | /* ***************** Mode3 ******************************/ |
| 16944 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 16945 | unsigned int res) |
| 16946 | { |
| 16947 | switch (res >> 26) { |
| 16948 | case ALC880_HP_EVENT: |
| 16949 | alc663_two_hp_m1_speaker_automute(codec); |
| 16950 | break; |
| 16951 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16952 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16953 | break; |
| 16954 | } |
| 16955 | } |
| 16956 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16957 | #define alc663_mode3_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16958 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16959 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 16960 | { |
| 16961 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16962 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16963 | } |
| 16964 | /* ***************** Mode4 ******************************/ |
| 16965 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 16966 | unsigned int res) |
| 16967 | { |
| 16968 | switch (res >> 26) { |
| 16969 | case ALC880_HP_EVENT: |
| 16970 | alc663_21jd_two_speaker_automute(codec); |
| 16971 | break; |
| 16972 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16973 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16974 | break; |
| 16975 | } |
| 16976 | } |
| 16977 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16978 | #define alc663_mode4_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16979 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16980 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 16981 | { |
| 16982 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16983 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16984 | } |
| 16985 | /* ***************** Mode5 ******************************/ |
| 16986 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 16987 | unsigned int res) |
| 16988 | { |
| 16989 | switch (res >> 26) { |
| 16990 | case ALC880_HP_EVENT: |
| 16991 | alc663_15jd_two_speaker_automute(codec); |
| 16992 | break; |
| 16993 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16994 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16995 | break; |
| 16996 | } |
| 16997 | } |
| 16998 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16999 | #define alc663_mode5_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17000 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17001 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 17002 | { |
| 17003 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17004 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17005 | } |
| 17006 | /* ***************** Mode6 ******************************/ |
| 17007 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 17008 | unsigned int res) |
| 17009 | { |
| 17010 | switch (res >> 26) { |
| 17011 | case ALC880_HP_EVENT: |
| 17012 | alc663_two_hp_m2_speaker_automute(codec); |
| 17013 | break; |
| 17014 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17015 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17016 | break; |
| 17017 | } |
| 17018 | } |
| 17019 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17020 | #define alc663_mode6_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17021 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17022 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 17023 | { |
| 17024 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17025 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17026 | } |
| 17027 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17028 | /* ***************** Mode7 ******************************/ |
| 17029 | static void alc663_mode7_unsol_event(struct hda_codec *codec, |
| 17030 | unsigned int res) |
| 17031 | { |
| 17032 | switch (res >> 26) { |
| 17033 | case ALC880_HP_EVENT: |
| 17034 | alc663_two_hp_m7_speaker_automute(codec); |
| 17035 | break; |
| 17036 | case ALC880_MIC_EVENT: |
| 17037 | alc_mic_automute(codec); |
| 17038 | break; |
| 17039 | } |
| 17040 | } |
| 17041 | |
| 17042 | #define alc663_mode7_setup alc663_mode1_setup |
| 17043 | |
| 17044 | static void alc663_mode7_inithook(struct hda_codec *codec) |
| 17045 | { |
| 17046 | alc663_two_hp_m7_speaker_automute(codec); |
| 17047 | alc_mic_automute(codec); |
| 17048 | } |
| 17049 | |
| 17050 | /* ***************** Mode8 ******************************/ |
| 17051 | static void alc663_mode8_unsol_event(struct hda_codec *codec, |
| 17052 | unsigned int res) |
| 17053 | { |
| 17054 | switch (res >> 26) { |
| 17055 | case ALC880_HP_EVENT: |
| 17056 | alc663_two_hp_m8_speaker_automute(codec); |
| 17057 | break; |
| 17058 | case ALC880_MIC_EVENT: |
| 17059 | alc_mic_automute(codec); |
| 17060 | break; |
| 17061 | } |
| 17062 | } |
| 17063 | |
| 17064 | #define alc663_mode8_setup alc663_m51va_setup |
| 17065 | |
| 17066 | static void alc663_mode8_inithook(struct hda_codec *codec) |
| 17067 | { |
| 17068 | alc663_two_hp_m8_speaker_automute(codec); |
| 17069 | alc_mic_automute(codec); |
| 17070 | } |
| 17071 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17072 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 17073 | { |
| 17074 | unsigned int present; |
| 17075 | unsigned char bits; |
| 17076 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17077 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17078 | bits = present ? HDA_AMP_MUTE : 0; |
| 17079 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17080 | HDA_AMP_MUTE, bits); |
| 17081 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17082 | HDA_AMP_MUTE, bits); |
| 17083 | } |
| 17084 | |
| 17085 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 17086 | { |
| 17087 | unsigned int present; |
| 17088 | unsigned char bits; |
| 17089 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17090 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17091 | bits = present ? HDA_AMP_MUTE : 0; |
| 17092 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17093 | HDA_AMP_MUTE, bits); |
| 17094 | } |
| 17095 | |
| 17096 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 17097 | unsigned int res) |
| 17098 | { |
| 17099 | switch (res >> 26) { |
| 17100 | case ALC880_HP_EVENT: |
| 17101 | alc663_g71v_hp_automute(codec); |
| 17102 | break; |
| 17103 | case ALC880_FRONT_EVENT: |
| 17104 | alc663_g71v_front_automute(codec); |
| 17105 | break; |
| 17106 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17107 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17108 | break; |
| 17109 | } |
| 17110 | } |
| 17111 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17112 | #define alc663_g71v_setup alc663_m51va_setup |
| 17113 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17114 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 17115 | { |
| 17116 | alc663_g71v_front_automute(codec); |
| 17117 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17118 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17119 | } |
| 17120 | |
| 17121 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 17122 | unsigned int res) |
| 17123 | { |
| 17124 | switch (res >> 26) { |
| 17125 | case ALC880_HP_EVENT: |
| 17126 | alc663_m51va_speaker_automute(codec); |
| 17127 | break; |
| 17128 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17129 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17130 | break; |
| 17131 | } |
| 17132 | } |
| 17133 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17134 | #define alc663_g50v_setup alc663_m51va_setup |
| 17135 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17136 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 17137 | { |
| 17138 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17139 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17140 | } |
| 17141 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17142 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 17143 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17144 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17145 | |
| 17146 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 17147 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17148 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17149 | |
| 17150 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 17151 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17152 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17153 | { } /* end */ |
| 17154 | }; |
| 17155 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17156 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 17157 | /* Master Playback automatically created from Speaker and Headphone */ |
| 17158 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17159 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17160 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17161 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17162 | |
| 17163 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17164 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17165 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 17166 | |
| 17167 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17168 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17169 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 17170 | { } /* end */ |
| 17171 | }; |
| 17172 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17173 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17174 | #define alc662_loopbacks alc880_loopbacks |
| 17175 | #endif |
| 17176 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17177 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 17178 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17179 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 17180 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 17181 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 17182 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 17183 | |
| 17184 | /* |
| 17185 | * configuration and preset |
| 17186 | */ |
| 17187 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 17188 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 17189 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 17190 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 17191 | [ALC662_5ST_DIG] = "6stack-dig", |
| 17192 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 17193 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17194 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17195 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17196 | [ALC663_ASUS_M51VA] = "m51va", |
| 17197 | [ALC663_ASUS_G71V] = "g71v", |
| 17198 | [ALC663_ASUS_H13] = "h13", |
| 17199 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17200 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 17201 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 17202 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 17203 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 17204 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 17205 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17206 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 17207 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 17208 | [ALC272_DELL] = "dell", |
| 17209 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17210 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17211 | [ALC662_AUTO] = "auto", |
| 17212 | }; |
| 17213 | |
| 17214 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17215 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17216 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 17217 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17218 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 17219 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 17220 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 17221 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 17222 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 17223 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17224 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 17225 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17226 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17227 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 17228 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 17229 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 17230 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 17231 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17232 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17233 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 17234 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17235 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 17236 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 17237 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 17238 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17239 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17240 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 17241 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 17242 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17243 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 17244 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 17245 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 17246 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17247 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17248 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 17249 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17250 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17251 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 17252 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 17253 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17254 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
| 17255 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 17256 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17257 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 17258 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 17259 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17260 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17261 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 17262 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17263 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17264 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 17265 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17266 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 17267 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 17268 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17269 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17270 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 17271 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 17272 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17273 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17274 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17275 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 17276 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 17277 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 17278 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17279 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 17280 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 17281 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 17282 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 17283 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17284 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 17285 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 17286 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17287 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 17288 | ALC663_ASUS_H13), |
David Santinoli | 7aee674 | 2009-12-09 12:34:26 +0100 | [diff] [blame] | 17289 | SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17290 | {} |
| 17291 | }; |
| 17292 | |
| 17293 | static struct alc_config_preset alc662_presets[] = { |
| 17294 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17295 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17296 | .init_verbs = { alc662_init_verbs }, |
| 17297 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17298 | .dac_nids = alc662_dac_nids, |
| 17299 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17300 | .dig_in_nid = ALC662_DIGIN_NID, |
| 17301 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17302 | .channel_mode = alc662_3ST_2ch_modes, |
| 17303 | .input_mux = &alc662_capture_source, |
| 17304 | }, |
| 17305 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17306 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17307 | .init_verbs = { alc662_init_verbs }, |
| 17308 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17309 | .dac_nids = alc662_dac_nids, |
| 17310 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17311 | .dig_in_nid = ALC662_DIGIN_NID, |
| 17312 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 17313 | .channel_mode = alc662_3ST_6ch_modes, |
| 17314 | .need_dac_fix = 1, |
| 17315 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17316 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17317 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17318 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17319 | .init_verbs = { alc662_init_verbs }, |
| 17320 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17321 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17322 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 17323 | .channel_mode = alc662_3ST_6ch_modes, |
| 17324 | .need_dac_fix = 1, |
| 17325 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17326 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17327 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17328 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17329 | .init_verbs = { alc662_init_verbs }, |
| 17330 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17331 | .dac_nids = alc662_dac_nids, |
| 17332 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17333 | .dig_in_nid = ALC662_DIGIN_NID, |
| 17334 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 17335 | .channel_mode = alc662_5stack_modes, |
| 17336 | .input_mux = &alc662_capture_source, |
| 17337 | }, |
| 17338 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17339 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17340 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 17341 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17342 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17343 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17344 | .channel_mode = alc662_3ST_2ch_modes, |
| 17345 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 17346 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 17347 | .init_hook = alc662_lenovo_101e_all_automute, |
| 17348 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17349 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17350 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17351 | .init_verbs = { alc662_init_verbs, |
| 17352 | alc662_eeepc_sue_init_verbs }, |
| 17353 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17354 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17355 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17356 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17357 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17358 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17359 | .init_hook = alc662_eeepc_inithook, |
| 17360 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17361 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17362 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17363 | alc662_chmode_mixer }, |
| 17364 | .init_verbs = { alc662_init_verbs, |
| 17365 | alc662_eeepc_ep20_sue_init_verbs }, |
| 17366 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17367 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17368 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 17369 | .channel_mode = alc662_3ST_6ch_modes, |
| 17370 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17371 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17372 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17373 | .init_hook = alc662_eeepc_ep20_inithook, |
| 17374 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17375 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17376 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17377 | .init_verbs = { alc662_init_verbs, |
| 17378 | alc662_ecs_init_verbs }, |
| 17379 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17380 | .dac_nids = alc662_dac_nids, |
| 17381 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17382 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17383 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17384 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17385 | .init_hook = alc662_eeepc_inithook, |
| 17386 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17387 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17388 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17389 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 17390 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17391 | .dac_nids = alc662_dac_nids, |
| 17392 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17393 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17394 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17395 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17396 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17397 | .init_hook = alc663_m51va_inithook, |
| 17398 | }, |
| 17399 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17400 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17401 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 17402 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17403 | .dac_nids = alc662_dac_nids, |
| 17404 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17405 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17406 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17407 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17408 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17409 | .init_hook = alc663_g71v_inithook, |
| 17410 | }, |
| 17411 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17412 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17413 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 17414 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17415 | .dac_nids = alc662_dac_nids, |
| 17416 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17417 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17418 | .unsol_event = alc663_m51va_unsol_event, |
| 17419 | .init_hook = alc663_m51va_inithook, |
| 17420 | }, |
| 17421 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17422 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17423 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 17424 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17425 | .dac_nids = alc662_dac_nids, |
| 17426 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17427 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 17428 | .channel_mode = alc662_3ST_6ch_modes, |
| 17429 | .input_mux = &alc663_capture_source, |
| 17430 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17431 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17432 | .init_hook = alc663_g50v_inithook, |
| 17433 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17434 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17435 | .mixers = { alc663_m51va_mixer }, |
| 17436 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17437 | .init_verbs = { alc662_init_verbs, |
| 17438 | alc663_21jd_amic_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, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17445 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17446 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17447 | .init_hook = alc663_mode1_inithook, |
| 17448 | }, |
| 17449 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17450 | .mixers = { alc662_1bjd_mixer }, |
| 17451 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17452 | .init_verbs = { alc662_init_verbs, |
| 17453 | alc662_1bjd_amic_init_verbs }, |
| 17454 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17455 | .dac_nids = alc662_dac_nids, |
| 17456 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17457 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17458 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17459 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17460 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17461 | .init_hook = alc662_mode2_inithook, |
| 17462 | }, |
| 17463 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17464 | .mixers = { alc663_two_hp_m1_mixer }, |
| 17465 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17466 | .init_verbs = { alc662_init_verbs, |
| 17467 | alc663_two_hp_amic_m1_init_verbs }, |
| 17468 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17469 | .hp_nid = 0x03, |
| 17470 | .dac_nids = alc662_dac_nids, |
| 17471 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17472 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17473 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17474 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17475 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17476 | .init_hook = alc663_mode3_inithook, |
| 17477 | }, |
| 17478 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17479 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 17480 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17481 | .init_verbs = { alc662_init_verbs, |
| 17482 | alc663_21jd_amic_init_verbs}, |
| 17483 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17484 | .hp_nid = 0x03, |
| 17485 | .dac_nids = alc662_dac_nids, |
| 17486 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17487 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17488 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17489 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17490 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17491 | .init_hook = alc663_mode4_inithook, |
| 17492 | }, |
| 17493 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17494 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 17495 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17496 | .init_verbs = { alc662_init_verbs, |
| 17497 | alc663_15jd_amic_init_verbs }, |
| 17498 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17499 | .hp_nid = 0x03, |
| 17500 | .dac_nids = alc662_dac_nids, |
| 17501 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17502 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17503 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17504 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17505 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17506 | .init_hook = alc663_mode5_inithook, |
| 17507 | }, |
| 17508 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17509 | .mixers = { alc663_two_hp_m2_mixer }, |
| 17510 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17511 | .init_verbs = { alc662_init_verbs, |
| 17512 | alc663_two_hp_amic_m2_init_verbs }, |
| 17513 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17514 | .hp_nid = 0x03, |
| 17515 | .dac_nids = alc662_dac_nids, |
| 17516 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17517 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17518 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17519 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17520 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17521 | .init_hook = alc663_mode6_inithook, |
| 17522 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17523 | [ALC663_ASUS_MODE7] = { |
| 17524 | .mixers = { alc663_mode7_mixer }, |
| 17525 | .cap_mixer = alc662_auto_capture_mixer, |
| 17526 | .init_verbs = { alc662_init_verbs, |
| 17527 | alc663_mode7_init_verbs }, |
| 17528 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17529 | .hp_nid = 0x03, |
| 17530 | .dac_nids = alc662_dac_nids, |
| 17531 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17532 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17533 | .channel_mode = alc662_3ST_2ch_modes, |
| 17534 | .unsol_event = alc663_mode7_unsol_event, |
| 17535 | .setup = alc663_mode7_setup, |
| 17536 | .init_hook = alc663_mode7_inithook, |
| 17537 | }, |
| 17538 | [ALC663_ASUS_MODE8] = { |
| 17539 | .mixers = { alc663_mode8_mixer }, |
| 17540 | .cap_mixer = alc662_auto_capture_mixer, |
| 17541 | .init_verbs = { alc662_init_verbs, |
| 17542 | alc663_mode8_init_verbs }, |
| 17543 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17544 | .hp_nid = 0x03, |
| 17545 | .dac_nids = alc662_dac_nids, |
| 17546 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17547 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17548 | .channel_mode = alc662_3ST_2ch_modes, |
| 17549 | .unsol_event = alc663_mode8_unsol_event, |
| 17550 | .setup = alc663_mode8_setup, |
| 17551 | .init_hook = alc663_mode8_inithook, |
| 17552 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17553 | [ALC272_DELL] = { |
| 17554 | .mixers = { alc663_m51va_mixer }, |
| 17555 | .cap_mixer = alc272_auto_capture_mixer, |
| 17556 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 17557 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17558 | .dac_nids = alc662_dac_nids, |
| 17559 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17560 | .adc_nids = alc272_adc_nids, |
| 17561 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 17562 | .capsrc_nids = alc272_capsrc_nids, |
| 17563 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17564 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17565 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17566 | .init_hook = alc663_m51va_inithook, |
| 17567 | }, |
| 17568 | [ALC272_DELL_ZM1] = { |
| 17569 | .mixers = { alc663_m51va_mixer }, |
| 17570 | .cap_mixer = alc662_auto_capture_mixer, |
| 17571 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 17572 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17573 | .dac_nids = alc662_dac_nids, |
| 17574 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17575 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17576 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17577 | .capsrc_nids = alc662_capsrc_nids, |
| 17578 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17579 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17580 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17581 | .init_hook = alc663_m51va_inithook, |
| 17582 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17583 | [ALC272_SAMSUNG_NC10] = { |
| 17584 | .mixers = { alc272_nc10_mixer }, |
| 17585 | .init_verbs = { alc662_init_verbs, |
| 17586 | alc663_21jd_amic_init_verbs }, |
| 17587 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17588 | .dac_nids = alc272_dac_nids, |
| 17589 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17590 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17591 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17592 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17593 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17594 | .init_hook = alc663_mode4_inithook, |
| 17595 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17596 | }; |
| 17597 | |
| 17598 | |
| 17599 | /* |
| 17600 | * BIOS auto configuration |
| 17601 | */ |
| 17602 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17603 | /* convert from MIX nid to DAC */ |
| 17604 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
| 17605 | { |
| 17606 | if (nid == 0x0f) |
| 17607 | return 0x02; |
| 17608 | else if (nid >= 0x0c && nid <= 0x0e) |
| 17609 | return nid - 0x0c + 0x02; |
| 17610 | else |
| 17611 | return 0; |
| 17612 | } |
| 17613 | |
| 17614 | /* get MIX nid connected to the given pin targeted to DAC */ |
| 17615 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
| 17616 | hda_nid_t dac) |
| 17617 | { |
| 17618 | hda_nid_t mix[4]; |
| 17619 | int i, num; |
| 17620 | |
| 17621 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 17622 | for (i = 0; i < num; i++) { |
| 17623 | if (alc662_mix_to_dac(mix[i]) == dac) |
| 17624 | return mix[i]; |
| 17625 | } |
| 17626 | return 0; |
| 17627 | } |
| 17628 | |
| 17629 | /* look for an empty DAC slot */ |
| 17630 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 17631 | { |
| 17632 | struct alc_spec *spec = codec->spec; |
| 17633 | hda_nid_t srcs[5]; |
| 17634 | int i, j, num; |
| 17635 | |
| 17636 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
| 17637 | if (num < 0) |
| 17638 | return 0; |
| 17639 | for (i = 0; i < num; i++) { |
| 17640 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); |
| 17641 | if (!nid) |
| 17642 | continue; |
| 17643 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 17644 | if (spec->multiout.dac_nids[j] == nid) |
| 17645 | break; |
| 17646 | if (j >= spec->multiout.num_dacs) |
| 17647 | return nid; |
| 17648 | } |
| 17649 | return 0; |
| 17650 | } |
| 17651 | |
| 17652 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 17653 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 17654 | const struct auto_pin_cfg *cfg) |
| 17655 | { |
| 17656 | struct alc_spec *spec = codec->spec; |
| 17657 | int i; |
| 17658 | hda_nid_t dac; |
| 17659 | |
| 17660 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 17661 | for (i = 0; i < cfg->line_outs; i++) { |
| 17662 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); |
| 17663 | if (!dac) |
| 17664 | continue; |
| 17665 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 17666 | } |
| 17667 | return 0; |
| 17668 | } |
| 17669 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17670 | 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] | 17671 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17672 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17673 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17674 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 17675 | } |
| 17676 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17677 | 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] | 17678 | hda_nid_t nid, unsigned int chs) |
| 17679 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17680 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17681 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 17682 | } |
| 17683 | |
| 17684 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 17685 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 17686 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 17687 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 17688 | |
| 17689 | /* add playback controls from the parsed DAC table */ |
| 17690 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 17691 | const struct auto_pin_cfg *cfg) |
| 17692 | { |
| 17693 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17694 | static const char *chname[4] = { |
| 17695 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 17696 | }; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17697 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17698 | int i, err; |
| 17699 | |
| 17700 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17701 | nid = spec->multiout.dac_nids[i]; |
| 17702 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17703 | continue; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17704 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); |
| 17705 | if (!mix) |
| 17706 | continue; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17707 | if (i == 2) { |
| 17708 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17709 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17710 | if (err < 0) |
| 17711 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17712 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17713 | if (err < 0) |
| 17714 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17715 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17716 | if (err < 0) |
| 17717 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17718 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17719 | if (err < 0) |
| 17720 | return err; |
| 17721 | } else { |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 17722 | const char *pfx; |
| 17723 | if (cfg->line_outs == 1 && |
| 17724 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17725 | if (cfg->hp_outs) |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 17726 | pfx = "Speaker"; |
| 17727 | else |
| 17728 | pfx = "PCM"; |
| 17729 | } else |
| 17730 | pfx = chname[i]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17731 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17732 | if (err < 0) |
| 17733 | return err; |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 17734 | if (cfg->line_outs == 1 && |
| 17735 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 17736 | pfx = "Speaker"; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17737 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17738 | if (err < 0) |
| 17739 | return err; |
| 17740 | } |
| 17741 | } |
| 17742 | return 0; |
| 17743 | } |
| 17744 | |
| 17745 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17746 | /* return DAC nid if any new DAC is assigned */ |
| 17747 | 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] | 17748 | const char *pfx) |
| 17749 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17750 | struct alc_spec *spec = codec->spec; |
| 17751 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17752 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17753 | |
| 17754 | if (!pin) |
| 17755 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17756 | nid = alc662_look_for_dac(codec, pin); |
| 17757 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17758 | /* the corresponding DAC is already occupied */ |
| 17759 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 17760 | return 0; /* no way */ |
| 17761 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17762 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17763 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17764 | } |
| 17765 | |
| 17766 | mix = alc662_dac_to_mix(codec, pin, nid); |
| 17767 | if (!mix) |
| 17768 | return 0; |
| 17769 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 17770 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17771 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17772 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 17773 | if (err < 0) |
| 17774 | return err; |
| 17775 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17776 | } |
| 17777 | |
| 17778 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17779 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 17780 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17781 | |
| 17782 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 17783 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17784 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17785 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17786 | int i, num; |
| 17787 | hda_nid_t srcs[4]; |
| 17788 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17789 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17790 | /* need the manual connection? */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17791 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
| 17792 | if (num <= 1) |
| 17793 | return; |
| 17794 | for (i = 0; i < num; i++) { |
| 17795 | if (alc662_mix_to_dac(srcs[i]) != dac) |
| 17796 | continue; |
| 17797 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); |
| 17798 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17799 | } |
| 17800 | } |
| 17801 | |
| 17802 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 17803 | { |
| 17804 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17805 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17806 | int i; |
| 17807 | |
| 17808 | for (i = 0; i <= HDA_SIDE; i++) { |
| 17809 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 17810 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17811 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17812 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17813 | } |
| 17814 | } |
| 17815 | |
| 17816 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 17817 | { |
| 17818 | struct alc_spec *spec = codec->spec; |
| 17819 | hda_nid_t pin; |
| 17820 | |
| 17821 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17822 | if (pin) |
| 17823 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 17824 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17825 | pin = spec->autocfg.speaker_pins[0]; |
| 17826 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17827 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 17828 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17829 | } |
| 17830 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17831 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 17832 | |
| 17833 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 17834 | { |
| 17835 | struct alc_spec *spec = codec->spec; |
| 17836 | int i; |
| 17837 | |
| 17838 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 17839 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17840 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 17841 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 17842 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17843 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17844 | snd_hda_codec_write(codec, nid, 0, |
| 17845 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17846 | AMP_OUT_MUTE); |
| 17847 | } |
| 17848 | } |
| 17849 | } |
| 17850 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17851 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 17852 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17853 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 17854 | { |
| 17855 | struct alc_spec *spec = codec->spec; |
| 17856 | int err; |
| 17857 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 17858 | |
| 17859 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17860 | alc662_ignore); |
| 17861 | if (err < 0) |
| 17862 | return err; |
| 17863 | if (!spec->autocfg.line_outs) |
| 17864 | return 0; /* can't find valid BIOS pin config */ |
| 17865 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17866 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17867 | if (err < 0) |
| 17868 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17869 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17870 | if (err < 0) |
| 17871 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17872 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17873 | spec->autocfg.speaker_pins[0], |
| 17874 | "Speaker"); |
| 17875 | if (err < 0) |
| 17876 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17877 | if (err) |
| 17878 | spec->multiout.extra_out_nid[0] = err; |
| 17879 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17880 | "Headphone"); |
| 17881 | if (err < 0) |
| 17882 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17883 | if (err) |
| 17884 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17885 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17886 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17887 | return err; |
| 17888 | |
| 17889 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17890 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 17891 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17892 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 17893 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17894 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17895 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17896 | |
| 17897 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17898 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 17899 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17900 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17901 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17902 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 17903 | |
| 17904 | err = alc_auto_add_mic_boost(codec); |
| 17905 | if (err < 0) |
| 17906 | return err; |
| 17907 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17908 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 17909 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17910 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17911 | } |
| 17912 | |
| 17913 | /* additional initialization for auto-configuration model */ |
| 17914 | static void alc662_auto_init(struct hda_codec *codec) |
| 17915 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17916 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17917 | alc662_auto_init_multi_out(codec); |
| 17918 | alc662_auto_init_hp_out(codec); |
| 17919 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17920 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17921 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17922 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17923 | } |
| 17924 | |
| 17925 | static int patch_alc662(struct hda_codec *codec) |
| 17926 | { |
| 17927 | struct alc_spec *spec; |
| 17928 | int err, board_config; |
| 17929 | |
| 17930 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17931 | if (!spec) |
| 17932 | return -ENOMEM; |
| 17933 | |
| 17934 | codec->spec = spec; |
| 17935 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 17936 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 17937 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 17938 | if (alc_read_coef_idx(codec, 0)==0x8020){ |
| 17939 | kfree(codec->chip_name); |
| 17940 | codec->chip_name = kstrdup("ALC661", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 17941 | if (!codec->chip_name) { |
| 17942 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 17943 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 17944 | } |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 17945 | } |
| 17946 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17947 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 17948 | alc662_models, |
| 17949 | alc662_cfg_tbl); |
| 17950 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 17951 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 17952 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17953 | board_config = ALC662_AUTO; |
| 17954 | } |
| 17955 | |
| 17956 | if (board_config == ALC662_AUTO) { |
| 17957 | /* automatic parse from the BIOS config */ |
| 17958 | err = alc662_parse_auto_config(codec); |
| 17959 | if (err < 0) { |
| 17960 | alc_free(codec); |
| 17961 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17962 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17963 | printk(KERN_INFO |
| 17964 | "hda_codec: Cannot set up configuration " |
| 17965 | "from BIOS. Using base mode...\n"); |
| 17966 | board_config = ALC662_3ST_2ch_DIG; |
| 17967 | } |
| 17968 | } |
| 17969 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17970 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 17971 | if (err < 0) { |
| 17972 | alc_free(codec); |
| 17973 | return err; |
| 17974 | } |
| 17975 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17976 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 17977 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17978 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17979 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 17980 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 17981 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17982 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 17983 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 17984 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 17985 | if (!spec->adc_nids) { |
| 17986 | spec->adc_nids = alc662_adc_nids; |
| 17987 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 17988 | } |
| 17989 | if (!spec->capsrc_nids) |
| 17990 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17991 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17992 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17993 | set_capture_mixer(codec); |
Takashi Iwai | b959144 | 2009-03-16 15:25:00 +0100 | [diff] [blame] | 17994 | if (codec->vendor_id == 0x10ec0662) |
| 17995 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 17996 | else |
| 17997 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17998 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17999 | spec->vmaster_nid = 0x02; |
| 18000 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18001 | codec->patch_ops = alc_patch_ops; |
| 18002 | if (board_config == ALC662_AUTO) |
| 18003 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18004 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18005 | if (!spec->loopback.amplist) |
| 18006 | spec->loopback.amplist = alc662_loopbacks; |
| 18007 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 18008 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18009 | |
| 18010 | return 0; |
| 18011 | } |
| 18012 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18013 | static int patch_alc888(struct hda_codec *codec) |
| 18014 | { |
| 18015 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 18016 | kfree(codec->chip_name); |
| 18017 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18018 | if (!codec->chip_name) { |
| 18019 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18020 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18021 | } |
| 18022 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18023 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18024 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18025 | } |
| 18026 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18027 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18028 | * patch entries |
| 18029 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 18030 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18031 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 18032 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 18033 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 18034 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 18035 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18036 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 18037 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18038 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 18039 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18040 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 18041 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 18042 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 18043 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18044 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18045 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18046 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 18047 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18048 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 18049 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18050 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18051 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 18052 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18053 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 18054 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18055 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 18056 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18057 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 18058 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18059 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18060 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18061 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18062 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18063 | {} /* terminator */ |
| 18064 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 18065 | |
| 18066 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 18067 | |
| 18068 | MODULE_LICENSE("GPL"); |
| 18069 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 18070 | |
| 18071 | static struct hda_codec_preset_list realtek_list = { |
| 18072 | .preset = snd_hda_preset_realtek, |
| 18073 | .owner = THIS_MODULE, |
| 18074 | }; |
| 18075 | |
| 18076 | static int __init patch_realtek_init(void) |
| 18077 | { |
| 18078 | return snd_hda_add_codec_preset(&realtek_list); |
| 18079 | } |
| 18080 | |
| 18081 | static void __exit patch_realtek_exit(void) |
| 18082 | { |
| 18083 | snd_hda_delete_codec_preset(&realtek_list); |
| 18084 | } |
| 18085 | |
| 18086 | module_init(patch_realtek_init) |
| 18087 | module_exit(patch_realtek_exit) |